refinerycms icon indicating copy to clipboard operation
refinerycms copied to clipboard

Can not see old images when upgrade Refinerycms

Open ttmthanh opened this issue 4 years ago • 3 comments

After I upgrade Rails and Refinerycms refinerycms (3.0.0) (branch master) --> refinerycms (4.0.3) (branch 4-0 stable). I can not see old images before I upgrade, although amazons3 link present.

Here my images tab, new images are okay but old images can not show

ảnh

Please help me fix it, here my refinerycms gem file

gem 'refinerycms', github: 'refinery/refinerycms', branch: '4-0-stable'

gem 'refinerycms-acts-as-indexed', ['~> 3.0', '>= 3.0.0']

gem 'refinerycms-inquiries', git: 'https://github.com/refinery/refinerycms-inquiries', branch: 'master'

gem 'refinerycms-page-images', git: 'https://github.com/refinery/refinerycms-page-images', branch: 'master'

gem 'refinerycms-i18n', '~> 4.0'

gem 'refinerycms-authentication-devise', git: 'https://github.com/refinery/refinerycms-authentication-devise', branch: 'master'

gem 'refinerycms-wymeditor', ['~> 2.0', '>= 2.0.0']

ttmthanh avatar Jun 25 '20 02:06 ttmthanh

I'm not sure since our setups are different (I don't use s3, for instance) and I can't remember what it looked like inside Refinery. But after upgrading from 2.1.5 to 4.0.3, all our old images and file links 404'd. In our case it was due to a change in how the Dragonfly config is handled. The default had changed.

I had to change these files:

1: config/initializers/refinery/images.rb:

`config.dragonfly_url_format = "/system/images/:job/:basename.:ext"

This depends on what the path to your old images was:

2: config/initializers/refinery/resources.rb

config.dragonfly_url_format = "/system/resources/:job/:basename.:ext"

Again, it depends on what your old paths were.

3: config/initializers/refinery/dragonfly.rb

config.verify_urls = false

I would have loved to keep this on, but since I had so many pages with links added to the body text that would have to be manually edited, I had to set it to false.

It's not necessarily the same issue, but thought I'd share.

evenreven avatar Jun 25 '20 09:06 evenreven

i have the same issue, and @evenreven recommendations works, but now new images are not working.

marcelino056 avatar Aug 03 '23 13:08 marcelino056

Hi @marcelino056

I have checked old commits in my old refinery project. It is few years ago, when I did the commit, but I think it was working.

In my project I dont have config/initializers/refinery/dragonfly.rb file, instead I used the config.dragonfly_verify_urls = false for the images/resources initializers

Give it a try similar to this:

config/initializers/refinery/images.rb

Refinery::Images.configure do |config|
   # a lot of commented lines here ...
   config.dragonfly_verify_urls = false
   config.dragonfly_url_format = "/system/images/:job/:basename.:ext"
end

and

config/initializers/refinery/resources.rb

Refinery::Resources.configure do |config|
  # Configures the maximum allowed upload size (in bytes) for a file upload
  config.max_file_size = 1502428800

  # a lot of commented lines here

  config.dragonfly_verify_urls = false
 
  config.dragonfly_url_format = "/system/resources/:job/:basename.:format"
end

Let me know, if this fix fixed your issues.

Matho avatar Aug 08 '23 17:08 Matho