JulesInFrance Posted October 6, 2010 Share Posted October 6, 2010 Hi, I want to access the full product image in Skin => Template => Box => randomProd.tpl - then control it's size via XHTML/CSS. The current script [v4.3.9] says; $thumbRootPath = imgPath($randProd[0]['image'],$thumb=1,$path="root"); $thumbRelPath = imgPath($randProd[0]['image'],$thumb=1,$path="rel"); if (file_exists($thumbRootPath) && !empty($randProd[0]['image'])) { $box_content->assign("IMG_SRC", $thumbRelPath); } else { $box_content->assign("IMG_SRC", $GLOBALS['rootRel']."skins/". SKIN_FOLDER . "/styleImages/thumb_nophoto.gif"); } ... as a complete PHP novice I'm guessing $thumbRootPath/$thumbRelPath are just "temporary variables" used in an if/else loop, so I'm guessing $thumb=1 is the determining factor here? To get the full image do a I change that variable (and if so, to what?), or remove it altogether? Many thanks in advance for your assistance with this matter. Regards, Jules Quote Link to comment Share on other sites More sharing options...
Guest Danny Gillespie Posted November 30, 2010 Share Posted November 30, 2010 Removing the $thumb variable will do what you want, as will setting it equal to 0 or false. The imgPath function (found in includes/functions.inc.php, see below for reference) that looks up the image path defines the $thumb variable as false by default, so it gets the full image by default and only gets the thumbnail path if the variable is defined as anything other than 0, false, or null. If you remove the variable, make sure you leave the two commas like so $thumbRootPath = imgPath($randProd[0]['image'],,$path="root"); so that the function knows you are leaving a variable undefined or the $path variable will get used in place of $thumb. I would recommend just setting it equal to false because it's easier to understand if you come back later and don't remember exactly what you did. $thumbRootPath = imgPath($randProd[0]['image'],false,$path="root"); // or $thumbRootPath = imgPath($randProd[0]['image'],$thumb=false,$path="root"); Good luck with your modifications. // from CubeCart 4.4.2 function imgPath($masterImage, $thumb = false, $path = '') { // raw image path order is important $img = str_replace(array( CC_ROOT_DIR.CC_DS.'images'.CC_DS.'uploads'.CC_DS, $GLOBALS['storeURL'].'/images/uploads/', $GLOBALS['rootRel'].'images/uploads/', CC_ROOT_DIR.CC_DS.'cache'.CC_DS, 'images'.CC_DS.'uploads'.CC_DS, 'images/uploads/', ## Keeps windows servers happy ), '', $masterImage); if ($thumb) { //$img = "thumbs/thumb_".str_replace('thumb_', '', basename($img)); $img = "thumbs/thumb_".preg_replace('/^thumb_/', '//', basename($img), 1); } switch ($path) { case 'rel': $filepath = $GLOBALS['rootRel'].'images/uploads/'.str_replace('\\','/',$img); break; case 'root': $filepath = CC_ROOT_DIR.CC_DS.'images'.CC_DS.'uploads'.CC_DS.str_replace('/', CC_DS, $img); break; case 'url': $filepath = $GLOBALS['storeURL'].'/images/uploads/'.str_replace('\\','/',$img); break; case 'cacheRel': $filepath = $GLOBALS['rootRel'].'cache/'.str_replace('\\','/',$img); break; default: $filepath = $img; } return $filepath; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.