Default image not found

promes - January 5, 2009 - 21:38
Project:Taxonomy Image
Version:5.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I created a custom function to get an image for a node. Currently not all categories have an image defined. But I defined a default image (picture1.png) in the Taxonomy Image settings.
I call your module with statement: $img = taxonomy_image_display($tid);
where $tid has been searched for in $node->taxonomy. If found the $tid is set to the correct tid (checked) otherwise it is set to 0 (zero). I also tried -1.

I have problem:
When I am logged in I get the correct or default image, whatever is applicable. But sometimes I get a PHP message:
getimagesize(picture1.png) [function.getimagesize]: failed to open stream: No such file or directory in /var/www/html/sites/all/modules/taxonomy_image/taxonomy_image.module on line 249.

The consequence is the returned image-code has an empty width and height and cannot been displayed (at least in Internet Explorer but Firefox does display the image):
<img src="http://example.com/system/files/picture1.png" alt="termname5" title="termname5"  width="" height="" />

I hope you will have a solution.

#1

NancyDru - February 1, 2009 - 18:41
Status:active» postponed (maintainer needs more info)

The missing width and height are a result of the getimagesize failure. Does the image still exist or has it been deleted by some other function? I'm not sure what would happen if you call TI with an invalid tid.

#2

NancyDru - February 1, 2009 - 18:51
Status:postponed (maintainer needs more info)» fixed

I added a check for the getimagesize failure to return no image at all.

Committed to both branches.

#3

promes - February 2, 2009 - 10:06

The image still exists because it is the default image. I expected the default image (picture1.png) would be replaced in all cases no image has been found (or getimagesize returns a failure). The strange thing is: it is the default image for which the getimagesize returns the failure. Maybe this can help you to find the source of the problem.
I will implement the dev version to see the problem still exists: in my code I fetch the default image whenever no image is found.

#4

NancyDru - February 2, 2009 - 15:24

There is a difference between the path existing and the image existing. Can you put the full path into the URL bar and see the image? There are ways for images to be deleted that would not remove the path entries in the files table.

#5

promes - February 2, 2009 - 21:03

Thanks for your reply. Now I found out what I did wrong: I forgot the path to the default image in the settings. Stupid me: you warned to do this !
Now it works as if it always should have. Thanks a lot. I am sorry to bother you with my mistakes.
Maybe, if I have time, I will create a new contributed module from my code. There are some new ideas in it, not already in one of the other modules. But it needs some work to publish it and make it more general.

#6

NancyDru - February 2, 2009 - 23:33

Thanks for the update. I'm always open to new patches.

#7

NancyDru - February 12, 2009 - 18:43
Status:fixed» closed

Clearing the queue a bit.

 
 

Drupal is a registered trademark of Dries Buytaert.