alchemy_cms 5.3.4 → 5.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of alchemy_cms might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37f7ca98f0e6c0d8729e8ba6ef3fd432449dc5dba0b900ef72f9bd7494e406d5
4
- data.tar.gz: 0d3871f0f550d07b09eda00cd5a26427d9c80303cc0f008aea496a7a3e9a6579
3
+ metadata.gz: 2a2374c679c6d6962c9bb32d48f8f444def421fb927302b87f705a85e9e21d85
4
+ data.tar.gz: d3a682ccdf288d777e87f145b15121fa51d4008d3992ba39abb16e417e2ca1bb
5
5
  SHA512:
6
- metadata.gz: c91fb49f9939ad01bb30e88fe3042898d4cca8126e0d3ebc143f7a2232cf67cbbc176ca796c8b14f517683e975172ed8d7f92359989297cce30274bdb5bc981d
7
- data.tar.gz: a3e8bcf872db1d3276dffb0e56baa01a125e24f4ede546359854032a45446d5abc44b7559ab8f76fb1da8b692572ed7608f51542bf5a70dafb8a1ecb75b9bce3
6
+ metadata.gz: 1d40a29752e354e66b2186290cb229a2d0b89b77b258258c5488f4b8e6f56ffc7714bd6824e89e05a9075c53a3294c75eb5ebe70148c12d0b3fae84781f70a33
7
+ data.tar.gz: 1ddecd199116f699e351384bb460c39bb3203a71fa41a3d6e3319b8ad8107500049f1e37894f9a14f3e955930ae98e2dcc2d1458fff128dac2178b9d94cbeabc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.3.5 (2022-04-26)
2
+
3
+ - Add thumbnail processor to support resizing on animated GIFs [#2316](https://github.com/AlchemyCMS/alchemy_cms/pull/2316) ([kulturbande](https://github.com/kulturbande))
4
+ - Backport #2277 to 5.3 [#2306](https://github.com/AlchemyCMS/alchemy_cms/pull/2306) ([dbwinger](https://github.com/dbwinger))
5
+ - add webp - support to 5.3 stable [#2294](https://github.com/AlchemyCMS/alchemy_cms/pull/2294) ([kulturbande](https://github.com/kulturbande))
6
+
1
7
  ## 5.3.4 (2022-04-11)
2
8
 
3
9
  - Don't delete locals in render_element so they can be used by all elem… [#2284](https://github.com/AlchemyCMS/alchemy_cms/pull/2284) ([dbwinger](https://github.com/dbwinger))
@@ -8,6 +8,7 @@ module Alchemy
8
8
  def index
9
9
  @nodes = Node.all
10
10
  @nodes = @nodes.includes(:parent)
11
+ @nodes = @nodes.where(language_id: params[:language_id]) if params[:language_id]
11
12
  @nodes = @nodes.ransack(params[:filter]).result
12
13
 
13
14
  if params[:page]
@@ -67,7 +67,7 @@ module Alchemy
67
67
  # Returns the rendered resized image using imagemagick directly.
68
68
  #
69
69
  def resize(size, upsample = false)
70
- image_file.thumb(upsample ? size : "#{size}>")
70
+ image_file.thumbnail(upsample ? size : "#{size}>")
71
71
  end
72
72
 
73
73
  # Returns true if picture's width is greater than it's height
@@ -191,7 +191,7 @@ module Alchemy
191
191
  if is_smaller_than?(dimensions) && upsample == false
192
192
  dimensions = reduce_to_image(dimensions)
193
193
  end
194
- image_file.thumb("#{dimensions_to_string(dimensions)}#")
194
+ image_file.thumbnail("#{dimensions_to_string(dimensions)}#")
195
195
  end
196
196
 
197
197
  # Use imagemagick to custom crop an image. Uses -thumbnail for better performance when resizing.
@@ -28,7 +28,7 @@ module Alchemy
28
28
  large: "240x180",
29
29
  }.with_indifferent_access.freeze
30
30
 
31
- CONVERTIBLE_FILE_FORMATS = %w(gif jpg jpeg png).freeze
31
+ CONVERTIBLE_FILE_FORMATS = %w[gif jpg jpeg png webp].freeze
32
32
 
33
33
  TRANSFORMATION_OPTIONS = [
34
34
  :crop,
@@ -13,6 +13,8 @@ module Alchemy
13
13
  include Alchemy::Logger
14
14
  include Alchemy::Picture::Transformations
15
15
 
16
+ ANIMATED_IMAGE_FORMATS = %w[gif webp]
17
+
16
18
  attr_reader :picture, :render_format
17
19
 
18
20
  def_delegators :@picture,
@@ -86,7 +88,7 @@ module Alchemy
86
88
  end
87
89
 
88
90
  options = {
89
- flatten: render_format != "gif" && picture.image_file_format == "gif",
91
+ flatten: !render_format.in?(ANIMATED_IMAGE_FORMATS) && picture.image_file_format == "gif",
90
92
  }.with_indifferent_access.merge(options)
91
93
 
92
94
  encoding_options = []
@@ -17,7 +17,7 @@
17
17
  }) %>
18
18
  $('#<%= essence_node_editor.form_field_id %>').alchemyNodeSelect({
19
19
  placeholder: "<%= Alchemy.t(:search_node) %>",
20
- url: "<%= alchemy.api_nodes_path %>",
20
+ url: "<%= alchemy.api_nodes_path(language_id: essence_node_editor.page&.language_id) %>",
21
21
  query_params: <%== query_params.to_json %>,
22
22
  <% if essence_node_editor.essence.node %>
23
23
  <% serialized_node = ActiveModelSerializers::SerializableResource.new(essence_node_editor.essence.node, include: :ancestors) %>
@@ -173,6 +173,7 @@ uploader:
173
173
  - gif
174
174
  - png
175
175
  - svg
176
+ - webp
176
177
 
177
178
  # === Link Target Options
178
179
  #
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require "dragonfly_svg"
3
3
  require "alchemy/dragonfly/processors/crop_resize"
4
+ require "alchemy/dragonfly/processors/thumbnail"
4
5
 
5
6
  # Logger
6
7
  Dragonfly.logger = Rails.logger
@@ -16,4 +17,5 @@ Dragonfly::ImageMagick::Processors::Encode::WHITELISTED_ARGS << "flatten"
16
17
 
17
18
  Rails.application.config.after_initialize do
18
19
  Dragonfly.app(:alchemy_pictures).add_processor(:crop_resize, Alchemy::Dragonfly::Processors::CropResize.new)
20
+ Dragonfly.app(:alchemy_pictures).add_processor(:thumbnail, Alchemy::Dragonfly::Processors::Thumbnail.new)
19
21
  end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dragonfly/image_magick/processors/thumb"
4
+
5
+ module Alchemy
6
+ module Dragonfly
7
+ module Processors
8
+ class Thumbnail < ::Dragonfly::ImageMagick::Processors::Thumb
9
+ def call(content, geometry, opts = {})
10
+ # store content into an instance variable to use it in args_for_geometry - method
11
+ @content = content
12
+ super
13
+ end
14
+
15
+ ##
16
+ # due to a missing ImageMagick parameter animated GIFs were broken with the default
17
+ # Dragonfly Thumb processor
18
+ def args_for_geometry(geometry)
19
+ # resize all frames in a GIF
20
+ # @link https://imagemagick.org/script/command-line-options.php#coalesce
21
+ # @link https://imagemagick.org/script/command-line-options.php#deconstruct
22
+ @content&.mime_type == "image/gif" ? "-coalesce #{super} -deconstruct" : super
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -45,6 +45,17 @@ module Alchemy
45
45
  end
46
46
  end
47
47
 
48
+ initializer "alchemy.webp-mime_type" do
49
+ # Rails does not know anything about webp even in 2022
50
+ unless Mime::Type.lookup_by_extension(:webp)
51
+ Mime::Type.register("image/webp", :webp)
52
+ end
53
+ # Dragonfly uses Rack to read the mime type and guess what
54
+ unless Rack::Mime::MIME_TYPES[".webp"]
55
+ Rack::Mime::MIME_TYPES[".webp"] = "image/webp"
56
+ end
57
+ end
58
+
48
59
  initializer "alchemy.error_tracking" do
49
60
  if defined?(Airbrake)
50
61
  require_relative "error_tracking/airbrake_handler"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.3.4"
4
+ VERSION = "5.3.5"
5
5
 
6
6
  def self.version
7
7
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.4
4
+ version: 5.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2022-04-11 00:00:00.000000000 Z
16
+ date: 2022-04-26 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -1079,6 +1079,7 @@ files:
1079
1079
  - lib/alchemy/controller_actions.rb
1080
1080
  - lib/alchemy/deprecation.rb
1081
1081
  - lib/alchemy/dragonfly/processors/crop_resize.rb
1082
+ - lib/alchemy/dragonfly/processors/thumbnail.rb
1082
1083
  - lib/alchemy/element_definition.rb
1083
1084
  - lib/alchemy/elements_finder.rb
1084
1085
  - lib/alchemy/engine.rb