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

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...
1 min read

Ben Bassi Appears on New Hampshire Public Radio

"Talent exists in New Hampshire, but the challenge lies in finding it", Ben Bassi told Laura Knoy and her guests on "The Exchange" Thursday.
2 min read

Status of Nodereferences in Drupal 7

Before my time at CP, our site was going to get re-themed and the team looked to upgrade the site to Drupal 7, which was still in development at the time, but ultimately left it in Drupal 6. One of...
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.