Skip to content

Commit

Permalink
fix: variant resize image (#1964)
Browse files Browse the repository at this point in the history
* fix: variant resize image

* comment manual test

* tweak

* remove max

---------

Co-authored-by: Adrian <adrian@adrianthedev.com>
  • Loading branch information
Paul-Bob and adrianthedev authored Oct 9, 2023
1 parent d24fa9a commit 7118e51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div id="<%= dom_id file %>" class="relative min-h-full max-w-full flex-1 flex flex-col justify-between space-y-2">
<% if file.present? %>
<div class="flex flex-col justify-between h-full">
<div class="flex h-full">
<% if file.representable? && is_image? %>
<%= image_tag helpers.main_app.url_for(file), class: "rounded-lg object-cover w-full #{@extra_classes}" %>
<%= image_tag helpers.main_app.url_for(file), class: "rounded-lg max-w-full #{@extra_classes}" %>
<% elsif is_audio? %>
<%= audio_tag(helpers.main_app.url_for(file), controls: true, preload: false, class: 'w-full') %>
<% elsif is_video? %>
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/avo/resources/post_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PostResource < Avo::BaseResource
suggestions: -> { Post.tags_suggestions },
enforce_suggestions: true,
help: "The only allowed values here are `one`, `two`, and `three`"
field :cover_photo, as: :file, is_image: true, as_avatar: :rounded, full_width: true, hide_on: [], accept: "image/*", display_filename: false
field :cover_photo, as: :file, is_image: true, as_avatar: :rounded, full_width: true, hide_on: [], accept: "image/*", display_filename: false#, format_using: -> { value.variant(resize_to_limit: [100, 100]).processed.image }
field :cover_photo, as: :external_image, name: "Cover photo", required: true, hide_on: :all, link_to_resource: true, as_avatar: :rounded, format_using: -> { value.present? ? value&.url : nil }
field :audio, as: :file, is_audio: true, accept: "audio/*"
field :excerpt, as: :text, hide_on: :all, as_description: true do |model|
Expand Down

0 comments on commit 7118e51

Please sign in to comment.