corner image corner image
View Single Post
corner image corner image
  #7 (permalink)  
Old 18-06-2008, 20:40
tommy's Avatar
tommy tommy is offline
A1 is my Second Home!
 
Join Date: Mar 2008
Location: Essex
Posts: 376
Thanks: 45
Thanked 97 Times in 85 Posts
Quote:
Originally Posted by HuggyBear View Post
But they are scaled down before being sent to the visitors browser

PHP Code:
function tep_image($src$alt ''$width ''$height ''$params '') {

  
// if no file exists display the 'no image' file
  
if (!is_file($src)) {
  
$src "images/no_image.jpg";
  }
    
// Set default image variable and code
    
$image '<img src="' $src '"';
    
// Don't calculate if the image is set to a "%" width
    
if (strstr($width,'%') == false || strstr($height,'%') == false) {
        
$dont_calculate 0;
    } else {
        
$dont_calculate 1;
    }
    
// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
    
if (!strstr($image'pixel')) {
        
$dont_calculate 0;
    } else {
        
$dont_calculate 1;
    }
    
// Do we calculate the image size?
    
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {
        
// Get the image's information
        
if ($image_size = @getimagesize($src)) {
            
$ratio $image_size[1] / $image_size[0];
            
// Set the width and height to the proper ratio
            
if (!$width && $height) {
                
$ratio $height $image_size[1];
         
$width intval($image_size[0] * $ratio);
      } elseif (
$width && !$height) {
                
$ratio $width $image_size[0];
                
$height intval($image_size[1] * $ratio);
            } elseif (!
$width && !$height) {
                
$width $image_size[0];
                
$height $image_size[1];
            }
            
// Scale the image if not the original size
            
if ($image_size[0] != $width || $image_size[1] != $height) {
                
$rx $image_size[0] / $width;
                
$ry $image_size[1] / $height;
                if (
$rx $ry) {
                    
$width intval($height $ratio);
                } else {
                    
$height intval($width $ratio);
                }
        
       
// $image = '<img src="product_thumb.php?img=' . $src . '&amp;w=100&h=100"';
                
$image '<img src="product_thumb.php?img=' $src '&amp;w=' .
                
tep_output_string($width) . '&amp;h=' tep_output_string($height) . '"';
            }
        } elseif (
IMAGE_REQUIRED == 'false') {
            return 
'';
        } 
I don;t know if you understand PHP or not but that is the script that creates the thumbs and then stores them in a directory so it doesnt have to create that thumb again,

I have tried changing CSS anmd everything and the only thing that gets the images away from the top is to set margin-top to a fixed height which is no good...
my mistake I thought you meant scaling by just changing the width and not creating a totally new thumbnail image.
Reply With Quote
corner image corner image