Quote:
Originally Posted by mattw
how would change the image to call on a thumbnail when it displays in the cart (as my detailed images are all diffrent sizes) instead of using the image that is cached? i would also appreciate the same idea for the admin console. Any and all help is greatly appreciated.
|
here is an old php function I used to use some time ago to insert an image dynamically
Code:
<?
function InsertImagePath($imagepathname,$alttext="",$tagname="",$border="0",$vspace="0",$hspace="0")
{
error_reporting(0);
$imagesize = GetImageSize ($imagepathname);
error_reporting(7);?>
[img]<?echo($imagepathname);?>[/img] BORDER="<?echo($border);?>" ALT="<?echo($alttext);?>" NAME="<?echo($tagname);?>" VSPACE="<?echo($vspace);?>" HSPACE="<?echo($hspace);?>"><?
}
Note: the error_reporting was to prevent bitching to screen by the server if the file was not found as I recall -- this may be different now so check out
www.php.net
Sorry I dont have time to do the whole thing for you here -- my suggestion is to edit the code something like this:
Code:
<?
function InsertImagePath($imagepathname,$alttext="",$tagname="",$border="0",$vspace="0",$hspace="0")
{
error_reporting(0);
$imagesize = GetImageSize ($imagepathname);
error_reporting(7);?>
#### we hard code the width (say 50) -- then calc the proportional height for that image ####
$width = 50;
$height = $width * (imagesize[1] / imagesize[0]);
[img]<?echo($imagepathname);?>[/img]" HEIGHT="<?echo($height;) ?> BORDER="<?echo($border);?>" ALT="<?echo($alttext);?>" NAME="<?echo($tagname);?>" VSPACE="<?echo($vspace);?>" HSPACE="<?echo($hspace);?>"><?
}
you can hardcode or exclude some of the other parameters if you know they are always the same.
My own solution to the issue in this case, as I say, was to make all my images the same size instead