Hello to everyone,
first of all i want to apologize if this was discussed before (i didn't find any similar posts)
What i wanted to achieve is to be able to change the size of the $product_full_image to any other size so i can be able to use it as a thumb, medium, big and original picture size and all different sizes to be cached
What i found out is that you can change the $product_full_image size
by changing this
echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage"
border="0" title="'.$product_name.'" alt="'.$product_name .'"' )
with this
echo ps_product::image_tag(basename($product_full_image), 'class="browseProductImage"
border="0" title="'.$product_name.'"
alt="'.$product_name .'"',1,'product',250,300 )
this works fine but the image wasn't exactly 250px,300px and this was messing up the view
so in order to make the resizing of the image "resizing and cropping"
i looked up the class.img2thumb.php where i changed the function NewImgResize with this
function NewImgResize($orig_img,$newxsize,$newysize,$filename)
{
//$newxsize; //new width
//$newysize; //new height
$orig_size = getimagesize($filename);
$heightRatio = $orig_size[1]/$newysize;
$widthRatio = $orig_size[0]/$newxsize;
if($heightRatio < $widthRatio){
$optimalRatio = $heightRatio;
} else {
$optimalRatio = $widthRatio;
}
$optimalHeight = $orig_size[1]/$optimalRatio;
$optimalWidth = $orig_size[0]/$optimalRatio;
$imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
$bgfill = imagecolorallocate( $imageResized, $this->bg_red, $this->bg_green, $this->bg_blue );
imagealphablending($imageResized, false);
imagesavealpha($imageResized,true);
$transparent = imagecolorallocatealpha($imageResized, 255, 255, 255, 127);
imagecopyresampled($imageResized, $orig_img, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $orig_size[0], $orig_size[1]);
$cropStartX = ( $optimalWidth / 2) - ( $newxsize /2 );
$cropStartY = ( $optimalHeight/ 2) - ( $newysize/2 );
$crop = $imageResized;
$imageResized = imagecreatetruecolor($newxsize , $newysize);
$bgfill = imagecolorallocate( $imageResized, $this->bg_red, $this->bg_green, $this->bg_blue );
imagealphablending($imageResized, false);
imagesavealpha($imageResized,true);
$transparent = imagecolorallocatealpha($imageResized, 255, 255, 255, 127);
imagecopyresampled($imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newxsize, $newysize , $newxsize, $newysize);
return $imageResized;
}
and in show_image_in_imgtag.php i deleted this part
//if( $newxsize < $newysize ) {
// Don't let $newxsize be smaller than 55% of $newysize
// $newxsize = max( $newxsize, 0.55 * $newysize );
//}
//elseif( $newysize < $newxsize ) {
// Don't let $newysize be smaller than 55% of $newxsize
// $newysize = max( $newysize, 0.55 * $newxsize );
//}
so there are no restrictions about the dimensions of the image
and it works great (just make sure to delete the previously cached images
in products/resized/) so it can make new ones

So now i am stuck on other problem that i cant understand
i wanted to use this in one of my browse templates and in the flypage
so in the browse_5.php
i just used
echo ps_product::image_tag(basename($product_full_image), 'class="browseProductImage" border="0" title="'.$product_name.'" alt="'.$product_name .'"',1,'product',190,190 );
and it made perfect 190 by 190 thumbs
but in the flypage.tpl.php where i did
echo ps_product::image_tag(basename($product_full_image), 'class="main_img" border="0" title="'.$product_name.'" alt="'.$product_name .'"',1,'product',430,430 );
it shows the same picture that the previous script did (the one 190px by 190px)
and when i go to
localhost/components/com_virtuemart/show_image_in_imgtag.php?filename=image.png&newxsize=430&newysize=430&fileout=
the image is resized and cached then
but not where i run this from the flypage
i think the problem is in the show_image_in_imgtag.php where the variables
$fileout and $filename2 are checked
if( $resize_image ) {
if( file_exists($filename2)) {
$fileout = $filename2;
} else {
$fileout = dirname( $filename2 ) .'/'.$file."_".$newxsize."x".$newysize.$noimgif.$ext;
}
} else {
$fileout = $filename;
}
I'm stuck and I'll appreciate your help!