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

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...

Vote Drupal Into the 2009 Webware 100 List

The Webware 100 is an annual list of the top 100 Web 2.0 applications as voted by Web users and published on CNET.com. Drupal was on the list in 2007 and 2008, but it won't make the list in 2009...
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...
3 min read

How Secure is Your Website?

If your shopping list for features on your new website doesn't include application security features, it should. Our coding standards follow best practices in order to protect our clients from any...