I am using a series of imagecache_actions which work and then adding a final step whichis a Custom Action. I tried different image* functions on the $image object and none had any effect. So I sent a printout of the $image (and $image_context) to watchdog to see what I had:
stdClass::__set_state(array( 'source' => 'public://dbd10734089_361846880653185_905949197324848334_n.jpg', 'info' => array ( 'width' => 500, 'height' => 500, 'extension' => 'png', 'mime_type' => 'image/png', 'file_size' => 23551, ), 'toolkit' => 'gd', 'resource' => NULL, ))
Problem seems to be that $image->resource == NULL. I am expecting it to be a GD image resource which can be passed around to other GD functions, finally returning TRUE from the function.
Comments
Comment #2
tomotomo CreditAttribution: tomotomo commentedI also tried a new style with only one action, the Custom Action. Still no resource, but at least it's not due to some other action interfering.
Comment #3
dman CreditAttribution: dman as a volunteer commentedyes, the $resource should be a handle on a GD object.
I can't tell what could have made this happen for you, but my first suspicion is a corrupt or unreadable image. The data says the system thinks your png was exactly 500 px square - does that seem correct?
Have you tried with other (smaller) images like jpegs?
Comment #4
fietserwin- Are you using PHP5.5? If so, issue #2215369: Various bugs with PHP 5.5 imagerotate(), including when incorrect color indices are passed in might have gotten into your way.
- Can you try to call the custom action as first effect and see if you have a valid resoucv on that moment?
- Can you remove the custom action and see if you get image derivatives as expected.
Comment #5
tomotomo CreditAttribution: tomotomo commentedThis is on PHP 5.6. But I'm not using any kind of rotate actions anyways.
I tried it as the only action but it did not change anything.
Other actions alone work fine.
Comment #6
fietserwinI tested it locally wit this style:
And this is what I see in the watchdog:
Image: stdClass Object ( [source] => modules/image/sample.png [info] => Array ( [width] => 800 [height] => 600 [extension] => png [mime_type] => image/png [file_size] => 168110 ) [toolkit] => gd [resource] => Resource id #395 )
Context: Array ( [effect_data] => Array ( [php] => watchdog('image styles', 'Image: ' . print_r($image, TRUE), NULL, WATCHDOG_DEBUG); watchdog('image styles', 'Context: ' . print_r($image_context, TRUE), NULL, WATCHDOG_DEBUG); return TRUE; ) [managed_file] => [referring_entities] => Array ( ) [entity] => [image_field] => )
So with the sample image it works. then I tested it with a normal image and that gave comparable results, so that also works.
Thus, the image must come as NULL into the effect, making it a possible problem in your installation, not an error in this module. I guess that the error is in opening the image. Try to debug that part of Drupal (function image_gd_load).
Comment #7
fietserwinI guess this has been solved by now. Feel free to reopen if not, adding any additional info possible.