1 min read

Drupal DIY Tip: Exporting ImageCache Presets

Drupal DIY Tip: Exporting ImageCache Presets

For most Drupal configurations, it is advisable to use exporting functionality. In addition to facilitating version control and code duplication, this method offers more direct control over the node's settings, fields, etc. Recently I tried to export the code of an ImageCache preset, but found little guidance online as to where to insert the extracted code. With the assistance of Michelle Lauer (and by assistance I mean step-by-step instruction), I crafted the following simple procedure. Hopefully this will help the next person through the process!

  1. Go to the ImageCache page (usually site/admin/build/ImageCache), find the desired preset on the list, and click the accompanying Export link.
  2. Before copying your code, navigate to the pertinent module (usually a custom module just for your site).
  3. If the function "MYMODULE_imagecache_default_presets()" doesn't exist, create it now, and insert the line "return $presets;" before the function's closing bracket. If the function already does exist, take note of whether other presets exist.
  4. Return to the page containing the exported code. If there were pre-existing presets, then copy all but the first line ("$presets = array();"), and paste after that same line in the hook. Otherwise, copy everything and paste into the hook before the return statement. Save the file.
  5. Return to the ImageCache list, then refresh, or even flush all caches if you feel so inclined. The same preset should appear in the list, but with the word "Revert" substituted for "Delete". You may now click that button and confirm. In doing so, you remove the database copy of the preset and leave Drupal to work with only the exported code version.
  6. Congratulate yourself, because you're done.

by Zach Silversmith, CommonPlaces e-Solutions The award-winning engineering team at CommonPlaces thrives on Drupal solutions and streamlining the CMS development process. Need help getting your Drupal site to the next level? Talk to us today about our CP Mentor program or CP Rescue services -- and get your site launched!

Related Posts

1 min read

Greenopolis.com Sponsors Drupalcon Boston 2008

Greenopolis.com (Beta) was featured as a Gold Sponsor of Drupalcon Boston 2008, a gathering of over 800 Drupal professionals.
2 min read

How to Maintain a Technological Balance

For a very long time, CommonPlaces has been nationally recognized as one of the best Drupal design agencies in the country. We are very proud of this distinction, and we fully recognize that Drupal...
2 min read

End of Life Date for Drupal 6 Announced: February 24, 2016

  Last month, the widely used open source website development platform, Drupal, dropped some good news and some bad news. The amazingly good news was the release of Drupal 8, on November 19th, 2015....
1 min read

Lifetime Digital - Great Case Study on Drupal Scalability

There is a great case study available on Acquia.com that details the development decisions that were made for the family of Lifetime Network sites, all of which were built in Drupal. If you're...