Sometimes the path to a resized image appears broken. After I clear drupal cache it returns to correct path.
For example:
Normal path:
http://domain.com/sites/default/files/resize/File-Name-266x222.jpg
And then, after some time, it becomes like this:
http://var/www/vhosts/domain.com/httpdocs/sites/default/files/resize/remote/b28767631e05f8b2f21fa20a846d6b46-266x222.jpg
Can't figure the reason. Can someone suggest the right direction for search?
Comments
Comment #1
quicksketchCheck how your cron jobs are currently configured, plus any monitoring software you may have that is accessing the site in some way other than through the publicly accessible URL. Image Resize Filter has to do some work to calculate the paths of images on the server based on the URL of the page. If the site is being accessed some other way (such as through a localhost or IP address), it might cause it to calculate paths incorrectly.
Comment #2
Gus24 commentedThank you, quicksketch, for your assistance!
My cron jobs are configured to run cron.php every 10 minutes under root user from the site's root directory.
I can't understand why the error is so rare? I can't even reproduce the problem when I want it. Only if I accidently find a page with broken images. But I have a large site so my users find such pages too :)
I found that the drupal reports showed a php error when the image was broken:
imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 167 extraneous bytes before marker 0xd9 in file /var/www/vhosts/domain.com/httpdocs/includes/image.gd.inc in string 190.imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: '/var/www/vhosts/domain.com/httpdocs/tmp/image_resize_filter_51sohS' is not a valid JPEG file in file /var/www/vhosts/domain.com/httpdocs/includes/image.gd.inc in string 190.Seems like corrupted images, but they are fine. GD is Ok too.
added: And now I've found a page where the not resized image in node is not shown, and the resized image in comment is shown scaled (not clickable). And no error in drupal's reports. After some page reloads I get correct page with the first image and correctly resized second image.
Comment #3
Gus24 commentedI switched off javascript optimization. And I wrote site's URL in $base_url in setting.php. I have no php errors now but the problem with broken image paths remains. After I wrote $base_url broken path looks like "www.mysite.com/sites/default/files/resize/remote/b28767631e05f8b2f21fa20..." - it is almost correct url but without "http://" part.
Comment #4
digibrill commentedDid you ever find a solution for this?