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
Aivils Štoss edited this page Mar 22, 2018
·
2 revisions
How to: Process original image
Example
This uploader will process orginal image after store. It will resize image with max width 1200px. You can add this to your existing uploader and later reprocess all uploads with standard foo_model.file.recreate_versions! . It will reprocess original images too. You cannot restore original images after this.
classFileUploader < CarrierWave::Uploader::BaseincludeCarrierWave::MiniMagickstorage:fileafter:store,:process_original# Developer must ensure mogrify exists and available in host OS# Replace "-resize 1200" with your settingsdefprocess_original(new_file)ifversion_name.nil?system("mogrify -resize '1200\>' #{file.file}")endendend
Please ensure system command "mogrify" exists in target OS