Jump to content

Recommended Posts

Posted

I'm having a real issue here guys, my site's just gone live and the client has been adding some photos to the galleries. All looked great until I got further down and some of the images had not been resized (so were showing 3900px x 3000px or something similarly terrifying).

All the images are just in a foreach loop and the vast majority of the images are getting correctly resized but once one is not resized, all subsequent ones follow suit and are also not resized.

I can upload code, but has anyone else seen or heard of a similar issue?

Sorry for the desperation but it's sort of making the website look insane :)

Posted

Please, do upload the code, that will help. You don't tell which way you are doing your re-sizing. Is it on your template code or do you use "max image dimensions" field setting?

Posted

Hi Apeisa, thanks for replying, here is the code:

<?php foreach ($page->images as $image) {

$thumb = $image->size(100,75); ?>

<a href="<?php echo $image->url; ?>" class="lightbox" rel="<?php echo $page->title; ?>" title="<?php echo $image->description ?>"><img src="<?php echo $thumb->url; ?>" width="<?php echo $thumb->width; ?>" height="<?php echo $thumb->height; ?>" alt="<?php echo $page->title; ?>" class="small_frame" /></a>

<?php } ?>

I should point out that when I check in the admin, the full photos are showing too, not the thumbnails, but the "show thumbnails" option is ticked. This is the default images field that comes with PW.

sorry, but yeah the resizing is only in the template

Posted

Sorry my quick reply, read too fast. I don't see anything wrong in your code. What does $thumb->url looks like on the images that are not resized? Do they have 100x75 on their filename?

Hmm.. if the thumbnails are not showing in the admin, then it seems to be server issue. Do you have GD2 installed?

Posted

Yeah they were showing that on their filename but in the img tag the widths and heights weren't being set properly. It's strange as on one album it was the 10th photo onwards, on another it was like the 23rd and on other albums all the photos are fine, yet they all share the same field and same code.

On the photos that display OK front-end, in the back-end they are displayed as thumbnails (I think - they are all much smaller size, though not identical) But the non-working photos display very large.

Sorry but what is GD2? Can I check for it on phpmyinfo?

Posted

If some are being resized properly, you must have GD2 available, but you can look for it in phpinfo, just to be sure. I'm only guessing, but it might be an execution time or memory limit issue on your server if some have worked and others not. Is there anything in the server error logs?

Posted

I can't see anything related to it in the logs Dave but I'm thinking like you it could be something to do with memory. The thing is the equivalent backend images are not being scaled into thumbnails either, that must be relevant somehow?

I see that I have:

GD Version bundled (2.0.34 compatible)

Posted

If having this large images, you need lots of php memory to resize them. I experienced similar issue once.

Posted

It definitely sounds like the size of the uncompressed images exceeded the size of memory available to PHP. Check what your PHP memory limit is. If it's 128 or less, you may want to bump it up to 256 to better handle large images.

I've also occasionally come across an image that GD just won't resize. Whether it's too high of a DPI or what, I don't know. But if you are dealing with print-resolution images, it might not hurt to scale them to a more tangible size (72 dpi) before uploading too.

Posted

Thanks for the feedback also Ryan.

The thing is these photos only need to be 800-900px max so I just need to sort out the client with an image resizing tool!

Posted

Well I remember when testing locally and once on a developement server, that uploaded image doesn't resize, but will show up in fullsize after uploading. I couldn't figure out, as it only happened 1-2 times and with only 1-2 images. It might be something else, but it could be that it is the image itself, (CMYK, header bug, compression bug, etc...) fail to resize on the server. If I remember correctly even the image generated had like 0.0.jpg but showed in fullsize in the admin even though thumbnails are checked.

Posted

Oh, I remember another case where there was a similar behavior. It was when our designer created images saved as png but named as .jpg ... or vice versa. If it's always the same images that fail, make sure the images are really correct.

Posted

Oh, I remember another case where there was a similar behavior. It was when our designer created images saved as png but named as .jpg ... or vice versa. If it's always the same images that fail, make sure the images are really correct.

I might investigate this! Sounds like it may be the case will have to ask client. Cheers

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...