-
Notifications
You must be signed in to change notification settings - Fork 53
ConversionTasks
Are you upgrading your live app to the new file store creation date based format? Did you start out with PNG image storage, and later realize you need to store with the more space economic JPG instead? Not problem, Fleximage provides some rake tasks to help you out.
Each conversion rake task requires that you tell it the class for which you are changing the file store. For example, if you want to change to the new creation date based storage structure, for the class Photo
, you can run a rake task like this:
Or if you want to run this on your production database
rake fleximage:convert:to_nested FLEXIMAGE_CLASS=Photo RAILS_ENV=productionAfter you run any of these tasks, make sure to update your model class acts_as_fleximage
configuration is correct. These tasks affect the use_creation_date_based_directories
and image_storage_format
. Otherwise, the plugin will not find your master images for rendering.
These tasks manipulate the source files that make up your images. I take no responsibility if these rake tasks delete all your images. It is highly advised you back up you master image directory before running any of these tasks on your production site.
Here are all the conversion tasks:
-
fleximage:convert:to_nested
Converts your master image store from the flat basedpath/to/images/123.png
format to the creation date based formatpath/to/images/2008/11/12/123.png
based format. Use this task if you are upgrading from an older version of Fleximage.
-
fleximage:convert:to_flat
Converts your master image store from the creation date basedpath/to/images/2008/11/12/123.png
format to the flat formatpath/to/images/123.png
format. Note this will leave the date based directories in place, but they will be empty and can be easily deleted by hand since the top level is just grouped by year.
-
fleximage:convert:to_jpg
Converts all your stored master images from PNG format to JPG format. This will introduce artifacts into your previously lossless master images.
-
fleximage:convert:to_png
Converts all your stored master images from JPG format to PNG format. They will now takes up much more space, but all future images will be stored in a lossless format.
To run either of these tasks your model and database schema must be setup for database storage. See DatabaseOrFilesystemStorage.
-
fleximage:convert:to_db
Convert master image storage to use the database. Loads all file-stored images into the database.
-
fleximage:convert:to_filestore
Convert master image storage to use the file system. Loads all database images into files.