I'm using the ImageField module together with Imagecache to display a picture for one of my content types.
To display the content body I'm using Contemplate, I'm accessing the path to the image in the following way:
'[...]/imagecache/[preset]/[...]/'.$node->field_picture[0]['filename']
This usually works, but it breaks when someone uploads a picture with the same filename as the existing one. The file itself is then automatically named filename_0.jpg
instead of filename.jpg
, but the filename variable of the ImageField I'm accessing stays filename.jpg
.
This of course leads to the old image being displayed. It seems the filename variable does not do what I expected, what would be the correct way to access the Imagecache generated files?