Forgive me if this already exists: I'd like to see a function that returns merely a path to an imagecached image, as opposed to a full HTML tag. Sometimes I just want to link to an imagecached image, such as when I want to pop one up in a lightbox. Thanks!

Comments

sansui’s picture

I was just on here looking for this. For example, in a custom node.tpl.php this kinda works, but ends up duplicating the sites/default/files path etc twice:

<a rel=lightbox[set]" class="lightbox" href="/sites/default/files/imagecache/imagecache_preset/<?php print $node->field_image['0']['filepath']; ?>" title="<?php print $images['title']; ?>" rel="pagination"></a>

Would be nice to just have that path accessible for these situations, since it's nice to be able to link to a lightbox popup in a modified node tpl

dman’s picture

Were you looking for

imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) 
sansui’s picture

That works great actually :)

<?php print imagecache_create_url('media', $imagePath); ?>

traviscarden’s picture

Ah, nice. Thank you, @dman. Do you suppose this is worth noting on the module's documentation page?

mittalpatel’s picture

This really helped... Just exactly what I was looking for...

Thanks...

drewish’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.