2 Product Thumbnail image sizes Mod [finished]

<< < (2/38) > >>

Jeff_S:
My modified class.img2thumb.php - I modified this to allow for thumbnails that weren't square to have the canvas extended and filled with a bgcolour to the specified thumbnail size (passed as: Img2Thumb( $full_file, PSHOP_IMG_WIDTH, PSHOP_IMG_HEIGHT, $fileout_1, 1, 255, 255, 255) ) - you will need the gd2 library

The key thing here is the thumbMaxSize parameter - this is the beauty of this class.  If used instead of the Dynamic Thumbnail Resizing in the global configuration, this will resize your thumbnail to the actual dimensions set in the global configuration.  This is much better to use, as the Dynamic Thumbnail Resizing did not actually create a thumbnail and copy it into the product/resized/ folder - instead, it generates the thumbnail on the fly each time the full image is called and stores it in the product/ folder.

The other beautiful thing about the thumbMaxSize option, is it will always use your thumbnail image dimensions you specify - so if you set your thumbnail to be 100x100, it will always be 100x100 - as the canvas is extended with a bg fill (the last 3 parameters of the function) to your dimensions - maintaining your original images aspect ratio!  This is perfect for maintaining a quality layout - nothing worse than having a thumbnail that is 20x100 or 100x20 and messing up the rest of your layout.

Anyways, a couple of small modifications to take advantage of the thumbMaxSize and bg colour parameters... this is the whole class.img2thumb.php file with the exception of the top comments.

class Img2Thumb {
// New modification
/***
*   private variables - do not use
*    
*   @var int $bg_red 0-255 - red color variable for background filler
*   @var int $bg_green 0-255 - green color variable for background filler
*   @var int $bg_blue 0-255 - blue color variable for background filler
*   @var int $maxSize 0-1 - true/false - should thumbnail be filled to max pixels
***/

var $bg_red;
var $bg_green;
var $bg_blue;
var $maxSize;
/** @var string Filename for the thumbnail **/
var $fileout;

/***
* Constructor - requires following vars:
*
* @param string $filename image path
*
* These are additional vars:
*
* @param int $newxsize new maximum image width
* @param int $newysize new maximum image height
* @param string $fileout output image path
* @param int $thumbMaxSize whether thumbnail should have background fill to make it exactly $newxsize x $newysize
* @param int $bgred 0-255 - red color variable for background filler
* @param int $bggreen 0-255 - green color variable for background filler
* @param int $bgblue 0-255 - blue color variable for background filler
*
***/

// made all parameters passable values, instead of some being hard coded values
function Img2Thumb($filename, $newxsize, $newysize, $fileout, $thumbMaxSize, $bgred, $bggreen, $bgblue) {
global $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_COOKIE_VARS;
if (isset($HTTP_COOKIE_VARS))
$httpvars = $HTTP_COOKIE_VARS;
else if (isset($HTTP_POST_VARS))
$httpvars =  $HTTP_POST_VARS;
else if (isset($HTTP_GET_VARS))
$httpvars =  $HTTP_GET_VARS;

// New modification - checks color int to be sure within range
if($thumbMaxSize) {
$this->maxSize = true;
} else {
$this->maxSize = false;
}
if($bgred>=0 || $bgred<=255) {
$this->bg_red = $bgred;
} else {
$this->bg_red = 0;
}
if($bggreen>=0 || $bggreen<=255) {
$this->bg_green = $bggreen;
} else {
$this->bg_green = 0;
}
if($bgblue>=0 || $bgblue<=255) {
$this->bg_blue = $bgblue;
} else {
$this->bg_blue = 0;
}
$this->NewImgCreate($filename,$newxsize,$newysize,$fileout, $bgred, $bggreen, $bgblue);
}

/***
*
* private function - do not call
*
***/

function NewImgCreate($filename,$newxsize,$newysize,$fileout) {
$type = $this->GetImgType($filename);

$pathinfo = pathinfo( $fileout );
if( empty( $pathinfo['extension'])) {
$fileout .= '.'.$type;
}
$this->fileout = $fileout;
// free some memory
clearstatcache();

switch($type) {
case "gif":
// unfortunately this function does not work on windows
// via the precompiled php installation :(
// it should work on all other systems however.
if( function_exists("imagecreatefromgif") ) {
$orig_img = imagecreatefromgif($filename);
break;
} else {
echo 'Sorry, this server doesn\'t support <b>imagecreatefromgif()</b>';
exit;
break;
}

case "jpg":
$orig_img = imagecreatefromjpeg($filename);
break;

case "png":
$orig_img = imagecreatefrompng($filename);
break;
}

$new_img = $this->NewImgResize($orig_img,$newxsize,$newysize,$filename,$bgred,$bggreen,$bgblue);

if (!empty($fileout)) {
$this-> NewImgSave($new_img,$fileout,$type);
} else {
$this->NewImgShow($new_img,$type);
}
ImageDestroy($new_img);
ImageDestroy($orig_img);
}

/***
*
* private function - do not call
* includes function ImageCreateTrueColor and ImageCopyResampled which are available only under GD 2.0.1 or higher !
*
***/

function NewImgResize($orig_img,$newxsize,$newysize,$filename) {
//getimagesize returns array
// [0] = width in pixels
// [1] = height in pixels
// [2] = type
// [3] = img tag "width=xx height=xx" values

$orig_size = getimagesize($filename);
$maxX = $newxsize;
$maxY = $newysize;
if ($orig_size[0]<$orig_size[1]) {
$newxsize = $newysize * ($orig_size[0]/$orig_size[1]);
$adjustX = ($maxX - $newxsize)/2;
$adjustY = 0;
} else {
$newysize = $newxsize / ($orig_size[0]/$orig_size[1]);
$adjustX = 0;
$adjustY = ($maxY - $newysize)/2;
}
/* Original code removed to allow for maxSize thumbnails
$im_out = ImageCreateTrueColor($newxsize,$newysize);
ImageCopyResampled($im_out, $orig_img, 0, 0, 0, 0,
$newxsize, $newysize, $orig_size[0], $orig_size[1]);
*/

// New modification - creates new image at maxSize
if( $this->maxSize ) {
if( function_exists("imagecreatetruecolor") ) {
$im_out = imagecreatetruecolor($maxX,$maxY);
} else {
$im_out = imagecreate($maxX,$maxY);
}
// Need to image fill just in case image is transparent, don't always want black background
            $bgfill = imagecolorallocate( $im_out, $this->bg_red, $this->bg_green, $this->bg_blue );
if( function_exists( "imageAntiAlias" )) {
imageAntiAlias($im_out,true);
}
imagealphablending($im_out, false);
if( function_exists( "imagesavealpha")) {
imagesavealpha($im_out,true);
}
if( function_exists( "imagecolorallocatealpha")) {
$transparent = imagecolorallocatealpha($im_out, 255, 255, 255, 127);
}
imagefill( $im_out, 0,0, $bgfill );
if( function_exists("imagecopyresampled") ){
ImageCopyResampled($im_out, $orig_img, $adjustX, $adjustY, 0, 0, $newxsize, $newysize,$orig_size[0], $orig_size[1]);
} else {
ImageCopyResized($im_out, $orig_img, $adjustX, $adjustY, 0, 0, $newxsize, $newysize,$orig_size[0], $orig_size[1]);
}
} else {
if( function_exists("imagecreatetruecolor") ) {
$im_out = ImageCreateTrueColor($newxsize,$newysize);
} else {
$im_out = imagecreate($newxsize,$newysize);
}
if( function_exists( "imageAntiAlias" )){
imageAntiAlias($im_out,true);
}
imagealphablending($im_out, false);
if( function_exists( "imagesavealpha")){
imagesavealpha($im_out,true);
}
if( function_exists( "imagecolorallocatealpha")){
$transparent = imagecolorallocatealpha($im_out, 255, 255, 255, 127);
}
if( function_exists("imagecopyresampled") ){
ImageCopyResampled($im_out, $orig_img, 0, 0, 0, 0, $newxsize, $newysize,$orig_size[0], $orig_size[1]);
} else {
ImageCopyResized($im_out, $orig_img, 0, 0, 0, 0, $newxsize, $newysize,$orig_size[0], $orig_size[1]);
}
}
return $im_out;
}

/***
*
* private function - do not call
*
***/

function NewImgSave($new_img,$fileout,$type) {
switch($type) {
case "gif":
if( !function_exists("imagegif") ){
if (strtolower(substr($fileout,strlen($fileout)-4,4))!=".gif") {
$fileout .= ".png";
}
return imagepng($new_img,$fileout);
} else {
if (strtolower(substr($fileout,strlen($fileout)-4,4))!=".gif") {
$fileout .= '.gif';
}
return imagegif( $new_img, $fileout );
}
break;

case "jpg":
if (strtolower(substr($fileout,strlen($fileout)-4,4))!=".jpg") {
$fileout .= ".jpg";
}
return imagejpeg($new_img, $fileout, 100);
break;

case "png":
if (strtolower(substr($fileout,strlen($fileout)-4,4))!=".png") {
$fileout .= ".png";
}
return imagepng($new_img,$fileout);
break;
}
}

/***
*
* private function - do not call
*
***/

function NewImgShow($new_img,$type) {
/* Original code removed in favor of 'switch' statement
if ($type=="png") {
header ("Content-type: image/png");
return imagepng($new_img);
}
if ($type=="jpg") {
header ("Content-type: image/jpeg");
return imagejpeg($new_img);
}*/

switch($type) {

case "gif":
if( function_exists("imagegif") ) {
header ("Content-type: image/gif");
return imagegif($new_img);
break;
} else {
$this->NewImgShow( $new_img, "jpg" );
}

case "jpg":
header ("Content-type: image/jpeg");
return imagejpeg($new_img);
break;

case "png":
header ("Content-type: image/png");
return imagepng($new_img);
break;
}
}

/***
*
* private function - do not call
*
* 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF,
* 5 = PSD, 6 = BMP,
* 7 = TIFF(intel byte order),
* 8 = TIFF(motorola byte order),
* 9 = JPC, 10 = JP2, 11 = JPX,
* 12 = JB2, 13 = SWC, 14 = IFF
***/

function GetImgType($filename) {
$info = getimagesize($filename);
/* Original code removed in favor of 'switch' statement
if($size[2]==2) {
return "jpg";
}
elseif($size[2]==3) {
return "png";
*/
switch($info[2]) {
case 1:
return "gif";
break;

case 2:
return "jpg";
break;

case 3:
return "png";
break;

default:
return false;
}
}
}

Jeff_S:
My WORKING modified product.product_form.php (just the product image/thumbnail image section - this adds the second thumbnail section to the Images page of the product details) - this is the file that actually takes care of adding/updating your products details - the code section below is the "Image" tab section of the file.

<?php
$tabs->endTab();
$tabs->startTab( "<img src=\"". IMAGEURL ."ps_image/image.png\" width=\"16\" height=\"16\" align=\"center\" border=\"0\" />&nbsp;$images_label", "images-page");

if( !stristr( $db->f("product_full_image"), "http") && $clone_product != "1" ) {
echo "<input type=\"hidden\" name=\"product_full_image_curr\" value=\"". $db->f("product_full_image") ."\" />";
}
if( !stristr( $db->f("product_thumb_image"), "http") && $clone_product != "1" ) {
echo "<input type=\"hidden\" name=\"product_thumb_1_image_curr\" value=\"". $db->f("product_thumb_image") ."\" />";
}
if( !stristr( $db->f("product_thumb_image_2"), "http") && $clone_product != "1" ) {
echo "<input type=\"hidden\" name=\"product_thumb_2_image_curr\" value=\"". $db->f("product_thumb_image_2") ."\" />";
}
$ps_html->writableIndicator( array( IMAGEPATH."product", IMAGEPATH."product/resized") );

 ?>
<table class="adminform" >
<tr><?php

/***********************************/
/* Full Size Product Image Section */
/***********************************/

?>
<td valign="top" width="50%" style="border-right: 1px solid black;">
<h2><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_FULL_IMAGE ?></h2>
<table>
<tr>
<td colspan="2" ><?php 
if ($product_id) {
echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_UPDATE_LBL . "<br />";
} ?>
<input type="file" class="inputbox" name="product_full_image" size="50" maxlength="255" 
onchange="document.adminForm.product_full_image_url.value=''; 
document.adminForm.product_full_image_action[1].checked=true;" 
/>
</td>
</tr>
<tr>
<td valign="top" colspan="2">
<div style="font-weight:bold;"><?php echo $VM_LANG->_PHPSHOP_IMAGE_ACTION ?>:</div><br/>
<input type="radio" class="inputbox" id="product_full_image_action0" name="product_full_image_action" checked="checked" value="none" 
onchange="
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image, true );
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image_url, true );" 
/><label for="product_full_image_action0"><?php echo $VM_LANG->_PHPSHOP_NONE; ?></label><br />
<?php // Check if GD library is available
if( function_exists('imagecreatefromjpeg')) { ?>
<input type="radio" class="inputbox" id="product_full_image_action1" name="product_full_image_action" value="auto_resize" 
onchange="
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image, true );
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image_url, true );" 
/><label for="product_full_image_action1"><?php echo $VM_LANG->_PHPSHOP_FILES_FORM_AUTO_THUMBNAIL ?></label><br />
<?php }
if ($product_id and $db->f("product_full_image")) { ?>
<input type="radio" class="inputbox" id="product_full_image_action2" name="product_full_image_action" value="delete" 
onchange="
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image, true );
toggleDisable( document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image_url, true );" 
/><label for="product_full_image_action2"><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_DELETE_LBL ?></label><br />
<?php } ?>
</td>

</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td colspan="2"><?php echo _URL . " (" . _CMN_OPTIONAL . "!)&nbsp;"; ?>: 
<?php 
if( stristr($db->f("product_full_image"), "http") ) {
$product_full_image_url = $db->f("product_full_image");
} else if(!empty($_REQUEST['product_full_image_url'])) {
$product_full_image_url = $_REQUEST['product_full_image_url'];
} else {
$product_full_image_url = "";
} ?>
<input type="text" class="inputbox" size="40" name="product_full_image_url" value="<?php echo $product_full_image_url; ?>" 
onchange="if(this.value.length > 0 )
document.adminForm.product_full_image_action[1].checked=false;
else
document.adminForm.product_full_image_action[1].checked=true; 
toggleDisable(document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image_url, true ); 
toggleDisable(document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_1_image, true ); 
toggleDisable(document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_2_image_url, true ); 
toggleDisable(document.adminForm.product_full_image_action[1], document.adminForm.product_thumb_2_image, true ); 
" />
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td colspan="2" >
<div style="overflow:auto;"><?php 
if( $clone_product != "1" ) {
echo $ps_product->image_tag($db->f("product_full_image"), "", 0); 
} ?>
</div>
</td>
</tr>
</table>
</td><?php

/**************************************/
/* First Product Thumbnail generation */
/**************************************/

?>
<td valign="top" width="25%">
<h2><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_THUMB_IMAGE ?></h2>
<table>
<tr>
<td colspan="2" ><?php if ($product_id) {
echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_UPDATE_LBL . "<br>"; } ?>
<input type="file" class="inputbox" name="product_thumb_1_image" size="20" maxlength="255" 
onchange="if(document.adminForm.product_thumb_1_image.value!='') document.adminForm.product_thumb_1_image_url.value='';" 
/>
</td>
</tr>
<tr>
<td colspan="2" ><div style="font-weight:bold;"><?php echo $VM_LANG->_PHPSHOP_IMAGE_ACTION ?>:</div><br/>
<input type="radio" class="inputbox" id="product_thumb_1_image_action0" name="product_thumb_1_image_action" checked="checked" value="none" 
onchange="
toggleDisable( document.adminForm.product_thumb_1_image_action[1], document.adminForm.product_thumb_1_image, true ); 
toggleDisable( document.adminForm.product_thumb_1_image_action[1], document.adminForm.product_thumb_1_image_url, true );" 
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image, true );
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image_url, true );" 
/><label for="product_thumb_1_image_action0"><?php echo $VM_LANG->_PHPSHOP_NONE ?></label><br/>
<?php 
if ($product_id and $db->f("product_thumb_image")) { ?>
<input type="radio" class="inputbox" id="product_thumb_1_image_action1" name="product_thumb_1_image_action" value="delete" 
onchange="
toggleDisable( document.adminForm.product_thumb_1_image_action[1], document.adminForm.product_thumb_1_image, true ); 
toggleDisable( document.adminForm.product_thumb_1_image_action[1], document.adminForm.product_thumb_1_image_url, true );" 
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image, true );
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image_url, true );" 
/><label for="product_thumb_1_image_action1"><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_DELETE_LBL ?></label><br />
<?php } ?>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td width="21%" ><?php echo _URL." ("._CMN_OPTIONAL.")&nbsp;"; ?></td>
<td width="79%" ><?php 
if( stristr($db->f("product_thumb_image"), "http") ) {
$product_thumb_1_image_url = $db->f("product_thumb_image");
} else if(!empty($_REQUEST['product_thumb_1_image_url'])) {
$product_thumb_1_image_url = $_REQUEST['product_thumb_1_image_url'];
} else {
$product_thumb_1_image_url = "";
} ?>
<input type="text" class="inputbox" size="20" name="product_thumb_1_image_url" value="<?php echo $product_thumb_1_image_url ?>" />
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td colspan="2" style="">
<div style="overflow:auto;border: 1px solid #cfcfcf;"><?php 
if( $clone_product != "1" ) {
echo $ps_product->image_tag1($db->f("product_thumb_image"), "", 1); 
} ?>
</div>
</td>
</tr>
</table>
</td><?php

/***************************************/
/* Second Product Thumbnail generation */
/***************************************/

?>
<td valign="top" width="25%">
<h2><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_THUMB_IMAGE_2 ?></h2>
<table>
<tr>
<td colspan="2" ><?php if ($product_id) {
echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_UPDATE_LBL . "<br>"; } ?>
<input type="file" class="inputbox" name="product_thumb_2_image" size="20" maxlength="255" 
onchange="if(document.adminForm.product_thumb_2_image.value!='') document.adminForm.product_thumb_2_image_url.value='';" 
/>
</td>
</tr>
<tr>
<td colspan="2" ><div style="font-weight:bold;"><?php echo $VM_LANG->_PHPSHOP_IMAGE_ACTION ?>:</div><br/>
<input type="radio" class="inputbox" id="product_thumb_2_image_action0" name="product_thumb_2_image_action" checked="checked" value="none" 
onchange="
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image, true ); 
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image_url, true );" 
/><label for="product_thumb_2_image_action0"><?php echo $VM_LANG->_PHPSHOP_NONE ?></label><br/>
<?php 
if ($product_id and $db->f("product_thumb_image_2")) { ?>
<input type="radio" class="inputbox" id="product_thumb_2_image_action1" name="product_thumb_2_image_action" value="delete" 
onchange="
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image, true ); 
toggleDisable( document.adminForm.product_thumb_2_image_action[1], document.adminForm.product_thumb_2_image_url, true );" 
/><label for="product_thumb_2_image_action1"><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_IMAGE_DELETE_LBL ?></label><br />
<?php } ?>
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td width="21%" ><?php echo _URL." ("._CMN_OPTIONAL.")&nbsp;"; ?></td>
<td width="79%" ><?php 
if( stristr($db->f("product_thumb_image_2"), "http") ){
$product_thumb_2_image_url = $db->f("product_thumb_image_2");
} else if(!empty($_REQUEST['product_thumb_2_image_url'])) {
$product_thumb_2_image_url = $_REQUEST['product_thumb_2_image_url'];
} else {
$product_thumb_2_image_url = "";
} ?>
<input type="text" class="inputbox" size="20" name="product_thumb_2_image_url" value="<?php echo $product_thumb_2_image_url ?>" />
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td colspan="2" >
<div style="overflow:auto;"><?php 
if( $clone_product != "1" ){
echo $ps_product->image_tag2($db->f("product_thumb_image_2"), "", 1);
} ?>
</div>
</td>
</tr>
</table>
</td>

    </tr>
  </table>

<?php
$tabs->endTab();
$tabs->startTab( "<img src=\"". IMAGEURL ."ps_image/related.png\" width=\"16\" height=\"16\" align=\"center\" border=\"0\" />&nbsp;".$VM_LANG->_PHPSHOP_RELATED_PRODUCTS, "related-page");
?>

Jeff_S:
my modified admin.show_cfg.php (again, just the thumbnail - layout page section of code - this adds 2 more input boxes for entering the dimensions for the second thumbnail size - height and width):
<?php
    $subtabs2->endTab();
    $subtabs2->startTab( "Layout", "layout-2-page");
?>
<table class="adminform">
    <tr>
        <td valign="top"><strong><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_ADDTOCART_STYLE ?></strong></td>
        <td valign="middle" colspan="2"><?php
                    $path = IMAGEPATH."ps_image";
            $files = mosReadDirectory( "$path", "add-to-cart_?.", true, true);
            foreach ($files as $file) { 
                $file_info = pathinfo($file);
                $filename = $file_info['basename'];
                $checked = ($filename == PSHOP_ADD_TO_CART_STYLE) ? "checked=\"checked\"" : "";
                echo "<input type=\"radio\" name=\"conf_PSHOP_ADD_TO_CART_STYLE\" value=\"$filename\" $checked />&nbsp;&nbsp;";
                echo "<img align=\"center\" src=\"".IMAGEURL."ps_image/$filename\" border=\"0\" alt=\"$filename\" />";
                echo "&nbsp;&nbsp;($filename)<br />";
            }
        ?></td>
    </tr>
    <tr>
        <td colspan="3"><hr />&nbsp;</td>
    </tr>
    <?php
    if( function_exists('imagecreatefromjpeg')) {
     ?>
    
    <tr>
        <td width="30%" valign="top" align="right">
<strong><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_DYNAMIC_THUMBNAIL_RESIZING ?></strong></td>
        <td width="15%" valign="top">
            <input type="checkbox" name="conf_PSHOP_IMG_RESIZE_ENABLE" class="inputbox" <?php if (PSHOP_IMG_RESIZE_ENABLE == '1') echo "checked=\"checked\""; ?> value="1" />
        </td>
        <td width="55%"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_DYNAMIC_THUMBNAIL_RESIZING_TIP ?></td>
    </tr>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_WIDTH ?></td>
        <td>
            <input type="text" name="conf_PSHOP_IMG_WIDTH" class="inputbox" value="<?php echo PSHOP_IMG_WIDTH ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_WIDTH_TIP ?></td>
    </tr>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_HEIGHT ?></td>
        <td>
            <input type="text" name="conf_PSHOP_IMG_HEIGHT" class="inputbox" value="<?php echo PSHOP_IMG_HEIGHT ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_HEIGHT_TIP ?></td>
    </tr>
<?php // add section for second thumbnail size ?>
    <tr>
        <td colspan="3"><hr />&nbsp;</td>
    </tr>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_WIDTH ?></td>
        <td>
            <input type="text" name="conf_PSHOP_IMG_2_WIDTH" class="inputbox" value="<?php echo PSHOP_IMG_2_WIDTH ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_WIDTH_TIP ?></td>
    </tr>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_HEIGHT ?></td>
        <td>
            <input type="text" name="conf_PSHOP_IMG_2_HEIGHT" class="inputbox" value="<?php echo PSHOP_IMG_2_HEIGHT ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_HEIGHT_TIP ?></td>
    </tr>
    <tr>
        <td colspan="3"><hr />&nbsp;</td>
    </tr>
<?php // end section for second thumbnail size ?>
    <?php
    }
    else {
     echo '<input type="hidden" name="conf_PSHOP_IMG_RESIZE_ENABLE" value="0" />';
     echo '<input type="hidden" name="conf_PSHOP_IMG_WIDTH" value="'. PSHOP_IMG_WIDTH .'" />';
     echo '<input type="hidden" name="conf_PSHOP_IMG_HEIGHT" value="'. PSHOP_IMG_HEIGHT .'" />';
     echo '<input type="hidden" name="conf_PSHOP_IMG_2_WIDTH" value="'. PSHOP_IMG_2_WIDTH .'" />';
     echo '<input type="hidden" name="conf_PSHOP_IMG_2_HEIGHT" value="'. PSHOP_IMG_2_HEIGHT .'" />';
    }
    ?>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_SEARCHCOLOR1 ?></td>
        <td>
            <input type="text" name="conf_SEARCH_COLOR_1" class="inputbox" value="<?php echo SEARCH_COLOR_1 ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_SEARCHCOLOR1_EXPLAIN ?>
        </td>
    </tr>
    <tr>
        <td class="labelcell"><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_SEARCHCOLOR2 ?></td>
        <td>
            <input type="text" name="conf_SEARCH_COLOR_2" class="inputbox" value="<?php echo SEARCH_COLOR_2 ?>" />
        </td>
        <td><?php echo $VM_LANG->_PHPSHOP_ADMIN_CFG_SEARCHCOLOR2_EXPLAIN ?>
        </td>
    </tr>
</table>

Jeff_S:
You will also need to download your ps_config.php file from your server to find your conf_PSHOP_IMG_WIDTH section and add the vars for the second thumbnail as shown below:
            "PSHOP_IMG_WIDTH" => "conf_PSHOP_IMG_WIDTH",
            "PSHOP_IMG_HEIGHT" => "conf_PSHOP_IMG_HEIGHT",
            "PSHOP_IMG_2_WIDTH" => "conf_PSHOP_IMG_2_WIDTH",
            "PSHOP_IMG_2_HEIGHT" => "conf_PSHOP_IMG_2_HEIGHT",

Jeff_S:
Almost forgot: mods to english.php:

var $_PHPSHOP_FILES_FORM_AUTO_THUMBNAIL_2 = 'Auto-Create Second Thumbnail?';
var $_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_WIDTH = 'Thumbnail 2 Image Width';
var $_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_WIDTH_TIP = 'The target <strong>width</strong> of the second resized Thumbnail Image.';
var $_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_HEIGHT = 'Thumbnail 2 Image Height';
var $_PHPSHOP_ADMIN_CFG_THUMBNAIL_2_HEIGHT_TIP = 'The target <strong>height</strong> of the second resized Thumbnail Image.';

Navigation

[0] Message Index

[#] Next page

[*] Previous page