I think possibly I have found a logic flaw with the code in
includes/modules/main_product_image.php
when a site has only small and medium images, the logic is using the small image for the $products_image_large due to the variable $products_image_medium being checked a second time.
original code:
as you can see where the second check is taking place, where it is checking for the medium image, its actually looking for:PHP Code:$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = str_replace($products_image_extension, '', $products_image);
$products_image_medium = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
$products_image_large = $products_image_base . IMAGE_SUFFIX_LARGE . $products_image_extension;
$medium_image_check = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
// check for a medium image else use small
if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) {
$products_image_medium = DIR_WS_IMAGES . $products_image;
} else {
$products_image_medium = DIR_WS_IMAGES . 'medium/' . $products_image_medium;
}
// check for a large image else use medium else use small
if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
if (!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)) {
$products_image_large = DIR_WS_IMAGES . $products_image;
} else {
$products_image_large = DIR_WS_IMAGES . 'medium/' . $products_image_medium;
}
} else {
$products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large;
}
!file_exists(DIR_WS_IMAGES . 'medium/' . $products_image_medium)
and because $products_image_medium has already been defined, it will never actually find the file its looking for:
/images/medium/images/medium/12345_MED.jpg
Perhaps DrByte or someone can clarify incase I have my wires crossed, however I am getting around it by setting an additional variable at the top:
and then using this to carry out the second check:PHP Code:$second_medium_image_check = $products_image_base . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
Let me know.PHP Code:if (!file_exists(DIR_WS_IMAGES . 'large/' . $products_image_large)) {
if (!file_exists(DIR_WS_IMAGES . 'medium/' . $second_medium_image_check)) {
$products_image_large = DIR_WS_IMAGES . $products_image;
} else {
$products_image_large = DIR_WS_IMAGES . 'medium/' . $second_medium_image_check;
}
} else {
$products_image_large = DIR_WS_IMAGES . 'large/' . $products_image_large;
}
Cheers
Phil


Reply With Quote

