We've moved discussions to Discord

Anyone using animated gifs with Action Text/Trix Editor?

Brian Carpenter
When attaching an animated gif into the editor, only the first frame of the image appears.  Anyone been able to get them working?

Not sure if it's an issue on my end or expected behavior.

Chris Oliver
You should ask on the Rails / Trix GitHub.
Brian Carpenter
Thanks, will do.
Rob Jonson
did you get anywhere Brian Carpenter

I had gifs working, but the recent update to VIPS killed them

fwiw - the solution pre-VIPS was to change
/views/active_storage/blobs/_blob.html.erb

to

<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
  <% if blob.representable? %>
    <% if blob.content_type == Mime[:gif].to_s %>
      <%= image_tag url_for(blob.representation(loader: { page: nil }, coalesce: true, resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])) %>
    <% else %>
      <%= image_tag url_for(blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])) %>
    <% end %>
  <% end %>

  <figcaption class="attachment__caption">
    <% if caption = blob.try(:caption) %>
      <%= caption %>
    <% else %>
      <span class="attachment__name"><%= blob.filename %></span>
      <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
    <% end %>
  </figcaption>
</figure>

Since VIPS (I think), I just get the error 
Vips::Error: VipsOperation: class "coalesce" not found


https://github.com/rails/rails/issues/43917
Brian Carpenter
No, sorry.

I had made the same changes you did in /views/active_storage/blobs/_blob.html.erb but was still unable to to get animated gifs in my deployment.
Brian Carpenter
When attaching an animated gif into the editor, only the first frame of the image appears.  Anyone been able to get them working?

Not sure if it's an issue on my end or expected behavior.

Chris Oliver
You should ask on the Rails / Trix GitHub.
Brian Carpenter
Thanks, will do.
Rob Jonson
did you get anywhere Brian Carpenter

I had gifs working, but the recent update to VIPS killed them

fwiw - the solution pre-VIPS was to change
/views/active_storage/blobs/_blob.html.erb

to

<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
  <% if blob.representable? %>
    <% if blob.content_type == Mime[:gif].to_s %>
      <%= image_tag url_for(blob.representation(loader: { page: nil }, coalesce: true, resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])) %>
    <% else %>
      <%= image_tag url_for(blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ])) %>
    <% end %>
  <% end %>

  <figcaption class="attachment__caption">
    <% if caption = blob.try(:caption) %>
      <%= caption %>
    <% else %>
      <span class="attachment__name"><%= blob.filename %></span>
      <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
    <% end %>
  </figcaption>
</figure>

Since VIPS (I think), I just get the error 
Vips::Error: VipsOperation: class "coalesce" not found


https://github.com/rails/rails/issues/43917
Brian Carpenter
No, sorry.

I had made the same changes you did in /views/active_storage/blobs/_blob.html.erb but was still unable to to get animated gifs in my deployment.
Notifications
You’re not receiving notifications from this thread.
© 2022 Jumpstart Pro by GoRails, LLC