diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7f7444917..7dfc7a985 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -62,11 +62,11 @@ def active_storage_blob_variant_url if params[:type] == "video" url = rails_public_blob_url(blob) elsif params[:type] == "thumbnail" - url = rails_public_blob_url(blob.variant(quality: 95, resize_to_fill: [200, 200 / 9 * 5], format: :webp).processed) + url = rails_public_blob_url(blob.variant(saver: { quality: 95 }, resize_to_fill: [200, 200 / 9 * 5], format: :webp).processed) elsif params[:type] == "full" - url = rails_public_blob_url(blob.variant(quality: 95).processed) + url = rails_public_blob_url(blob.variant(saver: { quality: 95 }).processed) else - url = rails_public_blob_url(blob.variant(quality: 95, resize_to_limit: [1920, 1080], format: :webp).processed) + url = rails_public_blob_url(blob.variant(saver: { quality: 95 }, resize_to_limit: [1920, 1080], format: :webp).processed) end render json: url, layout: false diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 5608cd667..c89d9ccf1 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -454,8 +454,8 @@ def notify_discord(type) revision = @revision path = post_url(post.code.upcase) user_path = user_url(post.user.username) - image = @ordered_images.present? && @ordered_images.first.present? ? url_for(@ordered_images.first.variant(quality: 95).processed.url) : "" - avatar = @post.user.profile_image.present? ? url_for(@post.user.profile_image.variant(quality: 95, resize_to_fill: [120, 120]).processed.url) : "" + image = @ordered_images.present? && @ordered_images.first.present? ? url_for(@ordered_images.first.variant(saver: { quality: 95 }).processed.url) : "" + avatar = @post.user.profile_image.present? ? url_for(@post.user.profile_image.variant(saver: { quality: 95 }, resize_to_fill: [120, 120]).processed.url) : "" content = ActionController::Base.helpers.strip_tags(post.description).truncate(type == "New" ? 500 : 250) embed = Discord::Embed.new do diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index bfb4e144e..5b5228ff3 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -7,7 +7,7 @@ def url_for_post_thumbnail(post, width = 120, height = 68, size = "small") image = post.images.find_by_blob_id(JSON.parse(post.image_order).first) if image - url = rails_public_blob_url(image.variant(quality: 90, resize_to_fill: [width, height], format: :webp).processed) + url = rails_public_blob_url(image.variant(saver: { quality: 90 }, resize_to_fill: [width, height], format: :webp).processed) end rescue end diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rb index 6dd917f91..28506d66d 100644 --- a/app/serializers/post_serializer.rb +++ b/app/serializers/post_serializer.rb @@ -12,7 +12,7 @@ def thumbnail image = object.images.find_by_blob_id(JSON.parse(object.image_order).first) if image - url = rails_public_blob_url(image.variant(quality: 95, resize_to_fill: [690, 394]).processed) + url = rails_public_blob_url(image.variant(saver: { quality: 95 }, resize_to_fill: [690, 394]).processed) end end diff --git a/app/views/application/_body_bg.html.erb b/app/views/application/_body_bg.html.erb index 91ce032d4..b1847b816 100644 --- a/app/views/application/_body_bg.html.erb +++ b/app/views/application/_body_bg.html.erb @@ -23,12 +23,12 @@ <% if yield(:replace_body_bg) == "user" %> 640w, + <%= rails_public_blob_url(@user.banner_image.variant(saver: { quality: 90 }, resize_to_fill: [960, 400]).processed) %> 960w, + <%= rails_public_blob_url(@user.banner_image.variant(saver: { quality: 90 }, resize_to_fill: [1920, 400]).processed) %> 1920w" type="image/jpg"> - <%= image_tag rails_public_blob_url(@user.banner_image.variant(quality: 90, resize_to_fill: [1920, 400]).processed) %> + <%= image_tag rails_public_blob_url(@user.banner_image.variant(saver: { quality: 90 }, resize_to_fill: [1920, 400]).processed) %> <% end %> diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb index 23f94ef94..fdc7f5228 100644 --- a/app/views/articles/show.html.erb +++ b/app/views/articles/show.html.erb @@ -1,7 +1,7 @@ <% content_for :page_title, @article.title %> <% content_for :og_description, strip_tags(markdown(@article.content || "")).truncate(200).gsub("\n"," ") %> <% content_for :og_summary_small, "true" %> -<% begin %><% content_for :og_image, "#{ rails_public_blob_url(@article.cover_image.variant(quality: 95, resize_to_fill: [900, 500]).processed) if @article.cover_image.present? }" %><% rescue %><% end %> +<% begin %><% content_for :og_image, "#{ rails_public_blob_url(@article.cover_image.variant(saver: { quality: 95 }, resize_to_fill: [900, 500]).processed) if @article.cover_image.present? }" %><% rescue %><% end %> <% cache @article do %>
@@ -16,7 +16,7 @@
<% if @article.cover_image.attached? %> <% begin %> - <%= image_tag rails_public_blob_url(@article.cover_image.variant(quality: 95, resize_to_fill: [900, 500]).processed), loading: "lazy", alt: @article.title, width: 900, height: 500 %> + <%= image_tag rails_public_blob_url(@article.cover_image.variant(saver: { quality: 95 }, resize_to_fill: [900, 500]).processed), loading: "lazy", alt: @article.title, width: 900, height: 500 %> <% rescue %> <% end %> <% end %> diff --git a/app/views/blocks/post/_gallery.html.erb b/app/views/blocks/post/_gallery.html.erb index 19b67d3f7..8c3d18462 100644 --- a/app/views/blocks/post/_gallery.html.erb +++ b/app/views/blocks/post/_gallery.html.erb @@ -10,7 +10,7 @@ diff --git a/app/views/posts/form/_image_upload.html.erb b/app/views/posts/form/_image_upload.html.erb index b63dea6c0..62646ac75 100644 --- a/app/views/posts/form/_image_upload.html.erb +++ b/app/views/posts/form/_image_upload.html.erb @@ -5,8 +5,8 @@ <%= svelte_component("Dropzone", { images: (@ordered_images || {}).map { |i| { id: i.blob_id, - url: rails_public_blob_url(i.variant(quality: 95, resize_to_fill: [200, 200 / 9 * 5]).processed), - preview_url: rails_public_blob_url(i.variant(quality: 95).processed) + url: rails_public_blob_url(i.variant(saver: { quality: 95 }, resize_to_fill: [200, 200 / 9 * 5]).processed), + preview_url: rails_public_blob_url(i.variant(saver: { quality: 95 }).processed) } }, label: "Drop images here to add them to your post", help: "Images will be displayed in a 900x500 format (max 2MB per image, jpeg/png only)", diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 1d79748ff..ca880d66e 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -1,5 +1,5 @@ <% content_for :page_title, @post.title %> -<% begin %><% content_for :og_image, rails_public_blob_url(@ordered_images.first.variant(quality: 95, resize_to_fill: [900, 500]).processed) if @ordered_images.present? && @ordered_images.any? %><% rescue %><% end %> +<% begin %><% content_for :og_image, rails_public_blob_url(@ordered_images.first.variant(saver: { quality: 95 }, resize_to_fill: [900, 500]).processed) if @ordered_images.present? && @ordered_images.any? %><% rescue %><% end %> <% content_for :og_description, strip_tags(markdown(@post.description || "")).truncate(200).gsub("\n"," ") %> <% content_for :bg_size, "medium" %> diff --git a/app/views/profiles/_form.html.erb b/app/views/profiles/_form.html.erb index bfc32c354..39903cee8 100644 --- a/app/views/profiles/_form.html.erb +++ b/app/views/profiles/_form.html.erb @@ -56,7 +56,7 @@ <%= form.label :profile_image, "Profile image", class: "form-label" %>
- <%= image_tag (@user.profile_image.attached? ? rails_public_blob_url(@user.profile_image.variant(quality: 95, resize_to_fill: [140, 140]).processed) : "//:0"), + <%= image_tag (@user.profile_image.attached? ? rails_public_blob_url(@user.profile_image.variant(saver: { quality: 95 }, resize_to_fill: [140, 140]).processed) : "//:0"), data: { image_preview: "profile-image" } %>
@@ -82,7 +82,7 @@ This image is displayed at the top of your profile.

- <%= image_tag (@user.banner_image.attached? ? rails_public_blob_url(@user.banner_image.variant(quality: 90, resize_to_fill: [1920, 400]).processed) : "//:0"), + <%= image_tag (@user.banner_image.attached? ? rails_public_blob_url(@user.banner_image.variant(saver: { quality: 90 }, resize_to_fill: [1920, 400]).processed) : "//:0"), class: "mt-1/4 img-fluid", data: { image_preview: "banner" } %> diff --git a/app/views/profiles/_image.html.erb b/app/views/profiles/_image.html.erb index fc2aac5ca..33b45413c 100644 --- a/app/views/profiles/_image.html.erb +++ b/app/views/profiles/_image.html.erb @@ -1,6 +1,6 @@ <% if user.profile_image.attached? %> <% begin %> - <%= image_tag rails_public_blob_url(user.profile_image.variant(quality: 95, resize_to_fill: [size, size]).processed), loading: "lazy", aria: { label: "Profile image of '#{ user.username }'" }, height: size, width: size %> + <%= image_tag rails_public_blob_url(user.profile_image.variant(saver: { quality: 95 }, resize_to_fill: [size, size]).processed), loading: "lazy", aria: { label: "Profile image of '#{ user.username }'" }, height: size, width: size %> <% rescue %> <% end %> <% end %>