Jump to content

Recommended Posts

hi  :)

in admin module of plaincart(www.phpwebcommerce.com)

if i add a new category and upload a jpg file,i cannot see

the display of thumbnail..at running of the project..

 

I have attached :

C:\wamp\www\plaincart\admin\library\functions.php

C:\wamp\www\plaincart\admin\category\processcategory.php

 

Refer funtions at line 56 and 74 at processcategory.php and

refer functions at line 197 and 218 at funtions.php

 

Also if i am trying to echo $srcFile,$destFile and $dest by inserting it in the lines 220,221,236 in funtion.php file as follow..i do not get the output of echo when running..

 

function createThumbnail($srcFile, $destFile, $width, $quality = 75)
{
$thumbnail = '';

if (file_exists($srcFile)  && isset($destFile))
{
	$size        = getimagesize($srcFile);
	$w           = number_format($width, 0, ',', '');
	$h           = number_format(($size[1] / $size[0]) * $width, 0, ',', '');

	$thumbnail =  copyImage($srcFile, $destFile, $w, $h, $quality);
}
        

// return the thumbnail file name on sucess or blank on fail
return basename($thumbnail);
}

/*
Copy an image to a destination file. The destination
image size will be $w X $h pixels
*/
function copyImage($srcFile, $destFile, $w, $h, $quality = 75)
{
[color=red]echo $srcFile;
echo $destFile [/color] 
    
    $tmpSrc     = pathinfo(strtolower($srcFile));
    $tmpDest    = pathinfo(strtolower($destFile));
    $size       = getimagesize($srcFile);

    if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg")
    {
       $destFile  = substr_replace($destFile, 'jpg', -3);
       $dest      = imagecreatetruecolor($w, $h);
       imageantialias($dest, TRUE);
    } elseif ($tmpDest['extension'] == "png") {
       $dest = imagecreatetruecolor($w, $h);
       imageantialias($dest, TRUE);
    } else {
      return false;
    }
    [color=red]echo $dest;[/color]
    switch($size[2])
    {
       case 1:       //GIF
           $src = imagecreatefromgif($srcFile);
           break;
       case 2:       //JPEG
           $src = imagecreatefromjpeg($srcFile);
           break;
       case 3:       //PNG
           $src = imagecreatefrompng($srcFile);
           break;
       default:
           return false;
           break;
    }

    imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]);

    switch($size[2])
    {
       case 1:
       case 2:
           imagejpeg($dest,$destFile, $quality);
           break;
       case 3:
           imagepng($dest,$destFile);
    }
    return $destFile;

}

 

 

[attachment deleted by admin]

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.