Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Using imagecache with the Image or Embedded Media Field modules

Parent Feed: 

Actually, there is a way to use imagecache presets with the image module without patches. It involves creating a View that manually applies the imagecache preset to the image field (not imagefield). You'll need views customfield.

Create a view and add the relationships "Image:File" and "Image:Node." Then add fields "File:path," "Node->title," and "Customfield: PHP Code." Add this to your php customfield script:

files_image_filepath; $imagecache_preset = "Front-Slide-ic"; //enter your own imagecache preset here $attributes = array('class' => 'lightbox'); //if you want to add attributes $image_title = $data->node_image_title; print theme('imagecache', $imagecache_preset, $image_src, $image_title, $image_title, $attributes); ?>

Using this method allows you to use Image Crop to manually select the crop area.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web