Jump to content

Cubecart 4 Thumbnails


huggettm

Recommended Posts

Not sure if CC4 is discussed on here?

 

But ill try :)

I think I modified our thumbnails to point to actual images rather than be created based off the main image.

 

Having recently added some new products, for the first time in years the thumbnails do not work (they are named correctly and in the correct file)

 

Can anyone tell me what file controls where the thumbnail path is stored?

Link to comment
Share on other sites

thanks that seems to control the size of the file when it is created by cubecart, I dont understand why the thumbnails are not associated with the product though, they are in the correct folder and called thumb_

 

the main product images work.

im wondering if it might be a mysql / mysqli error?

Link to comment
Share on other sites

In the file /includes/functions.inc.php, near line 888 (CC448), there is the function imgPath() where the $thumb argument may be true. If so, then the following code is run:

if ($thumb) {
	//$img = "thumbs/thumb_".str_replace('thumb_', '', basename($img));
	$img = "thumbs/thumb_".preg_replace('/^thumb_/', '//', basename($img), 1);
}

Would you say this started happening after an upgrade from a much earlier version?

I disagree with the replacement string, although I am sure a lot more people would have complained if this was a real problem.

Because CC3/4 is a lot more forgiving about outputting rogue content ahead of schedule, let's try this:

In /includes/content/viewCat.inc.php, near line 366, find:

if (file_exists($thumbRoot)) {
	$view_cat->assign('SRC_PROD_THUMB', $thumbRootRel);
} else {
	$view_cat->assign('SRC_PROD_THUMB', $GLOBALS['rootRel'].'skins/'. SKIN_FOLDER . '/styleImages/thumb_nophoto.gif');
}

Change to:

if (file_exists($thumbRoot)) {
	$view_cat->assign('SRC_PROD_THUMB', $thumbRootRel);
} else { echo "\n<!--\nThumbnail root path: ".$thumbRoot."\n-->\n";
	$view_cat->assign('SRC_PROD_THUMB', $GLOBALS['rootRel'].'skins/'. SKIN_FOLDER . '/styleImages/thumb_nophoto.gif');
}

The echo will send the image path for the thumbnail to the browser. Where it will end up in the HTML of the page, I don't know. Have your browser show you the HTML source and you should easily find it.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...