Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change image extension when converting formats. #1446

Merged
merged 1 commit into from
Aug 27, 2014

Conversation

nashby
Copy link
Contributor

@nashby nashby commented Aug 27, 2014

It's a new version of #404 but I think it should be default behaviour and we don't need that rename option. @bensie what do you think?

@bensie
Copy link
Member

bensie commented Aug 27, 2014

Looks great!

bensie added a commit that referenced this pull request Aug 27, 2014
Change image extension when converting formats.
@bensie bensie merged commit dfe2fe4 into carrierwaveuploader:master Aug 27, 2014
@nashby nashby deleted the change-file-extension branch December 27, 2016 07:33
@mterenzio
Copy link

Was this reverted at some point? It wasn't working for me and I notice the relevant code is no longer in Master

@dem1tris
Copy link

dem1tris commented Mar 9, 2022

@mterenzio Same question. It must be delegated to imageprocessing gem, but now it doesn't work

@mshibuya
Copy link
Member

@mterenzio @dem1tris Then could you open a new issue? Thanks.

@dem1tris
Copy link

dem1tris commented Mar 10, 2022

@mshibuya It seems like #2125, #2126, #2127 are still actual.
As I debugged yesterday, cause is probably in CarrierWave::Storage::File#cache!.
Here is new_file.move_tonew_file.move_to(::File.expand_path(uploader.cache_path, uploader.root), uploader.permissions, uploader.directory_permissions, true) with the keep_filename == true.

Now new_path is formed from uploader's point of view which creates "foo/bar/version_origname.origext". But new_file at this moment is already named properly by imageprocessing: "/some/path/origname.newext". Although keep_filename == true passes original_filename as filename in hash, file path is rewritten now and ending with old extension again.

Btw, I found the hint in Readme section about RMagick:

def filename
      super.chomp(File.extname(super)) + '.newext' if original_filename.present?
end

Putting it inside version helped me. But it shouldn't be necessary with MiniMagick.

UPD. Replaced with

def full_filename(for_file)
      for_file.chomp(File.extname(for_file)) + '.newext'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants