Drupal : Resizing images in feeds using image cache url's
You have a node type containing an image field. You want to construct a feed containing the image (and node title) but the image needs to be resized to a format you dont use on the site.
Here is how to do it:
Use imagecache module
Create a preset.
Construct the url where the image would be if the image cache module would generate it. This is the url you will put in your feed.
But why would I put an url in my feed to an image that doesnt exists? If the url where the image is supposed to be is called the image cache module will generate the image.
To discover the path where the image cache module will create your image, simply run print theme('imagacache', 'preset', $node->path_to_your_image) in your node tpl and check out under files/imagecache where the image was created.
This looks all very logical but calling to a path where no image exist isnt very intuitive you would expect the image to be created first by calling the theme('imagecache', ..) function. But it isnt. Just call the "would be" path and your fine.
Add new comment