For reasons I don't understand, this spell of black magic is required to get gifs to play nicely with active storage when using vips.
lang-ruby
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
<% if blob.representable? %>
<%= image_tag blob.representation(
loader: { n: -1 },
resize_to_limit:
local_assigns[:in_gallery] ? [800, 600] : [1024, 768])
%>
<% 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>While looking into this, I had to ask Twitter (who calls it X anyway?) and got a helpful pointer in the right direction from @sanyasi with this reply.
While looking into VIPS, I noticed many additional packages that might be helpful, so I updated my Dockerfile (just in case). I can't vouch for any of these yet, but here is the updated dockerfile:
While looking into VIPS, I noticed many additional packages that might be helpful, so I updated my Dockerfile (just in case). I can't vouch for any of these yet, but here is the updated dockerfile:
lang-dockerfile
# Install base packages
RUN apt-get update -qqy && \
apt-get install --no-install-recommends -y wget gpg && \
wget -q -O- https://packagecloud.io/dcommander/libjpeg-turbo/gpgkey | \
gpg --dearmor >/etc/apt/trusted.gpg.d/libjpeg-turbo.gpg && \
echo "deb [signed-by=/etc/apt/trusted.gpg.d/libjpeg-turbo.gpg] https://packagecloud.io/dcommander/libjpeg-turbo/any/ any main" \
> /etc/apt/sources.list.d/libjpeg-turbo.list && \
apt-get update -qqy && \
apt-get install --no-install-recommends -y \
curl \
ffmpeg \
libcfitsio10 \
libcgif0 \
libexif12 \
libexpat1 \
libfftw3-dev \
libglib2.0-0 \
libgsf-1-114 \
libimagequant0 \
libjemalloc2 \
libjpeg-turbo-official \
liblcms2-2 \
libmatio11 \
libopenexr-3-1-30 \
libopenjp2-7 \
libopenslide0 \
liborc-0.4-0 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpng16-16 \
libpoppler-glib8 \
librsvg2-2 \
libtiff6 \
libvips \
libwebp7 \
postgresql-client \
zlib1g && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives && \
mkdir -p /rails/tmp /rails/log /rails/db /rails/storage
