You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've implemented a gallery on one of my projects using the code from the readme and the page load times in production on the gallery page are incredibly slow. I only need a gallery with 10 images max, but it is slow with just 4.
We've had problems with cropping images being slow and using more memory that we'd like (taking our server out). Here's our current solution to deal with this:
routes.rb:
get '/system/images/:job/:filename', constraints: lambda { |request| request.params[:filename] !~ /^image.[\w]+{2,5}/ },
to: redirect { |params, request| "/system/images/#{params[:job]}/image#{Rack::Mime::MIME_TYPES.invert[request.format.to_str]}#{'?' + request.query_string if request.query_string.present?}" }
refinery/images/dragonfly.rb:
app_images.configure do
[...]
if Refinery::Images.dragonfly_use_local_cache
before_serve do |job, env|
job.to_file("#{Rails.root}/public#{app_images.server.url_for(job).sub(/?.*$/, '')}.#{job.ext}")
end
end
end
This saves the images in /public dir for apache or nginx to serve up directly next time and essentially caches it forever. We don't have a problem with caching forever because we don't allow editing of images. Every uploaded image is a new Refinery::Image in the DB. The extra route above just stops someone from fetching abcdefghijkl.jpg, abcdefghijk.jpg, abcdefghij.jpg, abcdefghi.jpg, abcdefgh.jpg, abcdefg.jpg, abcdef.jpg, abcd.jpg, abc.jpg (we had someone take out the server with convert processes once in this way)
I've implemented a gallery on one of my projects using the code from the readme and the page load times in production on the gallery page are incredibly slow. I only need a gallery with 10 images max, but it is slow with just 4.
The view code:
I've tried it on another page (on a different and faster server) with the same results.
The text was updated successfully, but these errors were encountered: