views:

582

answers:

2

I am having trouble getting imagecache to generate a thumbnail based on a preset I have created named 'thumbnail'. I have an cck image_field and a custom node view. The code I am using to output my images is:

<?php foreach($node->field_comm_gallery as $galleryItem) { ?>
    <?php print theme('imagecache', 'thumbnail', $galleryItem['filepath'], $alt = '', ''); ?>
<?php } ?>

The output I get from the following is:

<img class="imagecache imagecache-thumbnail" title="" alt="" src="http://127.0.0.1/sites/default/files/imagecache/thumbnail/cedimages/3388564188_4427beac12_b_0.jpg"/&gt;

<img class="imagecache imagecache-thumbnail" title="" alt="" src="http://127.0.0.1/sites/default/files/imagecache/thumbnail/cedimages/3388564188_4427beac12_b_2.jpg"/&gt;

Everything looks correct but those files do not exist in that folder.

My question: Is the print theme(..) call supposed to generate the thumbnail on the fly when it is called, or is the thumbnail generated when a node is created/updated?

I am using the GD Image processer and receive no errors.

A: 

The node field value has within it the display value already generated. So using theme function is not needed. But the file should be created regardless. It looks like the problem is the permission to either Drupals temp folder or the files folder. Take a look at those in the files settings.

googletorp
A: 

Thanks for the help. It actually turned out to be this bug (http://drupal.org/node/540486#comment-2356560)

I had to remove the & from the function parameters in imageapi.module

function imageapi_gd_image_resize(&$image, $width, $height)

No clue why, but it seems to break when using php 5.x

ibuck
I have found core to be pretty good (though I have seen a couple fixed issues), but many contrib modules are still iffy with PHP 5.3.x. Keep in mind that Drupal 6 core is still PHP4 compatible, and many contrib modules try to be as well. The problem occurs because PHP 4 requires functions to declare that parameters are passed by reference, and PHP5 it was changed that objects are passed by reference by default. 5.3 is stricter in its reference handling, and some code will run fine on PHP5.2 but cannot also be compatible with both PHP4 and PHP5.3
GApple
I would suggest sticking with PHP5.2.x if you can for running Drupal 6, because of the few significant differences in PHP5.3.x. Drupal 7 will be dropping support for PHP4, so there shouldn't be any compatibility issues between different PHP 5.x versions.
GApple

related questions