Re: Small, medium, large versions of product images--I've gotten mixed messages
Thanks, but this doesn't work either. I've renamed to _1 .. _5, and numbers _1, _2 and _5 show, but _3 and _4 doesn't. Weird situation...
May be someone know which exactly module is responsible for collecting additional images? I've installed many mods, so one of them causes error, probably.
Re: Small, medium, large versions of product images--I've gotten mixed messages
Hm. More and more strange... It seems that Zen code itself works fine. When I've inserted 'echo $file' line into additional_images.php script where it reads out an image dir, it listed me about 1200 files instead of actual 1800+. As expected, there are _1, _2 and _5 in the list, but no _3 and _4. So, does this mean that I have problem with my hosting provider? Will search about this dir problem on the Internet meantime...
Re: Small, medium, large versions of product images--I've gotten mixed messages
Quote:
I thought it only looked for _01, _02, _03 etc at the end of filenames.
No, additional image filenames are not limited in any way to numbers. The one requirement (beside unique basenames) is that, when images are stored in subfolders like /images/mcl/, you must use an underscore _ to separate the basename and additional names. You have done this, so I don't see any impediment to proper function. I don't know why it wouldn't be working for you.
Re: Small, medium, large versions of product images--I've gotten mixed messages
Solved!
For some reason
while ($file = $dir->read()) {
on the line 43 of additional_images.php soen't work.
It should be modified to while (($file = $dir->read()) !== false) {
I never reported bugs, so I don't know how to report it correctly, but I hope that developers read this post and take a look to decide if this is really worth correction. Works like a charm for me.
Re: Small, medium, large versions of product images--I've gotten mixed messages
The original code is functionally equivalent to
while (($file = $dir->read()) != false) {
so for some reason apparently you are experiencing $dir->read() evaluating to 0 or null unexpectedly, which is handled as "false". Your addition requires it to be explicitly "false", solving your problem.
It cannot be a common problem, though, or thousands of people would have experienced and presumably reported it. Could there be anything at all non-standard about how your site handles images?
Re: Small, medium, large versions of product images--I've gotten mixed messages
I've found the answer. Here is what is written on http://www.php.net/manual/en/function.dir.php:
"Please note the fashion in which Directory::read()'s return value is checked in the example below. We are explicitly testing whether the return value is identical to (equal to and of the same type as - see Comparison Operators for more information) FALSE since otherwise, any directory entry whose name evaluates to FALSE will stop the loop. "
Exactly my case since I had '0' subfolder in the 'mcl' folder. So, the loop stopped after it got to read the '0' folder entry from the directory instance.
So, I'm sure that Zen code needs to be fixed now to prevent such rare (but possible, as you can see) cases.
Re: Small, medium, large versions of product images--I've gotten mixed messages
I see the main image:
/images/mcl/ob-oks5-18-1.jpg
I see the additional images:
/images/mcl/ob-oks5-18-1_all.jpg
/images/mcl/ob-oks5-18-1_fron.jpg
/images/mcl/ob-oks5-18-1_front.jpg
/images/mcl/ob-oks5-18-1_rear.jpg
/images/mcl/ob-oks5-18-1_side.jpg
Which one is missing? :unsure:
Re: Small, medium, large versions of product images--I've gotten mixed messages
Damn... There are 50 files in the Zen 1.5 distributive with directory handling. I suppose that each and every of them should be fixed. Will do this to my copy tomorrow.
Ajeh, nothing is missing now since I've fixed code checking return value of directory read for additional images. But there are 49 more php files that make wrong checks in other cases, and they need to be fixed as well to prevent problems if files or folders whose names evaluate to FALSE will be created somewhere (template '0', for example).
Re: Small, medium, large versions of product images--I've gotten mixed messages
Quote:
I had '0' subfolder in the 'mcl' folder.
This is critical information which you didn't tell us. Is this /0/ subfolder needed with that name?
Linda - the file edit in post #14 solved the problem, so all images now display. It is still puzzling because I would think the /mcl/ folder's content would be looked at sequentially and either all of one product's files would be processed before the 0 broke it, or the 0 would be processed first and you would not see any additional images. Maybe you can shed some light on MySQL/PHP processing in this area?
Re: Small, medium, large versions of product images--I've gotten mixed messages
Quote:
Originally Posted by
gjh42
This is critical information which you didn't tell us. Is this /0/ subfolder needed with that name?
How did I know that this is critical? I'm not a php pro. Just learning by experience. No need for such name for that folder (I just used to give simple names to temporary or 'to-process' folders - '0' puts it into beginning of the list to not forget about it).
Quote:
Maybe you can shed some light on MySQL/PHP processing in this area?
I've read about this issue few hours ago. Directory reads not in alphabetical order. It is rather equivalent to 'unsorted' form of the list, with folders scattered in midst of files. I didn't notice that problem until I created '0' folder few months ago. And I've noticed first problems today only (though they appeared long ago, most probably, since it is impossible to tell how OS arranges files and folders in FAT or whatever linux uses).