1 min read

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

2 min read

The Dilemma of Estimates

What do clients want from us, or from any digital agency that they are looking to hire? In making estimates, CommonPlaces strives to be transparent, honest, and professional; but this often means...
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

What Can Drupal Do For You?

As a Content Management Systems (CMS), Drupal allows the client to collaboratively create and edit various kinds of content. Gone are the days of calling your webmaster to swap out an image or update...
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...