par
nano855 » 27 févr. 2012, 11:20
Bonjour à tous!
j'ai trouvé un script pour recadré/redimenssionné les images. et quand je fait mon test sur un serveur type perso chez ovh ca marche... mais quand je veux le mettre sur un serveur type pro (toujours chez ovh) ca la me met
Notice: Undefined variable: src in /homez.488/xxxxxx/www/xxxx/thumb.php on line 46
ma question est: Pourquoi une difference entre les 2 serveurs alors que c'est le même code... Et comment arrangé ca?
Voici le code:
<?php
class cropImage{
var $imgSrc,$myImage,$cropHeight,$cropWidth,$x,$y,$thumb;
var $src = "";
function setImage($image)
{
//Your Image
$this->imgSrc = $image;
//getting the image dimensions
list($width, $height) = getimagesize($this->imgSrc);
//create image from the jpeg
$this->myImage = imagecreatefromjpeg($this->imgSrc) or die("Error: Cannot find image!");
if($width > $height) $biggestSide = $width; //find biggest length
else $biggestSide = $height;
$ratio =1-( 79/$width);
//The crop size will be half that of the largest side
$cropPercent = $ratio; // This will zoom in to 50% zoom (crop)
$this->cropWidth = $width*$cropPercent;
$this->cropHeight = $height*$cropPercent;
//getting the top left coordinate
$this->x = 0; //($width-$this->cropWidth)/2;
$this->y = 0; //($height-$this->cropHeight)/2;
}
function createThumb()
{
$thumbSizeWidth = 79; // will create a 250 x 250 thumb
$thumbSizeHeight = 53;
$this->thumb = imagecreatetruecolor($thumbSizeWidth, $thumbSizeHeight);
imagecopyresampled($this->thumb, $this->myImage, 0, 0, $this->x, $this->y, $thumbSizeWidth, $thumbSizeHeight, $this->cropWidth, $this->cropHeight);
}
function renderImage()
{
header('Content-type: image/jpeg');
imagejpeg($this->thumb);
imagedestroy($this->thumb);
}
}
$image = new cropImage;
$image->setImage($src);
$image->createThumb();
$image->renderImage();
?>
Merci pour l'aide.
Bonjour à tous!
j'ai trouvé un script pour recadré/redimenssionné les images. et quand je fait mon test sur un serveur type perso chez ovh ca marche... mais quand je veux le mettre sur un serveur type pro (toujours chez ovh) ca la me met
[b]Notice: Undefined variable: src in /homez.488/xxxxxx/www/xxxx/thumb.php on line 46[/b]
ma question est: Pourquoi une difference entre les 2 serveurs alors que c'est le même code... Et comment arrangé ca?
Voici le code:
[php]<?php
class cropImage{
var $imgSrc,$myImage,$cropHeight,$cropWidth,$x,$y,$thumb;
var $src = "";
function setImage($image)
{
//Your Image
$this->imgSrc = $image;
//getting the image dimensions
list($width, $height) = getimagesize($this->imgSrc);
//create image from the jpeg
$this->myImage = imagecreatefromjpeg($this->imgSrc) or die("Error: Cannot find image!");
if($width > $height) $biggestSide = $width; //find biggest length
else $biggestSide = $height;
$ratio =1-( 79/$width);
//The crop size will be half that of the largest side
$cropPercent = $ratio; // This will zoom in to 50% zoom (crop)
$this->cropWidth = $width*$cropPercent;
$this->cropHeight = $height*$cropPercent;
//getting the top left coordinate
$this->x = 0; //($width-$this->cropWidth)/2;
$this->y = 0; //($height-$this->cropHeight)/2;
}
function createThumb()
{
$thumbSizeWidth = 79; // will create a 250 x 250 thumb
$thumbSizeHeight = 53;
$this->thumb = imagecreatetruecolor($thumbSizeWidth, $thumbSizeHeight);
imagecopyresampled($this->thumb, $this->myImage, 0, 0, $this->x, $this->y, $thumbSizeWidth, $thumbSizeHeight, $this->cropWidth, $this->cropHeight);
}
function renderImage()
{
header('Content-type: image/jpeg');
imagejpeg($this->thumb);
imagedestroy($this->thumb);
}
}
$image = new cropImage;
$image->setImage($src);
$image->createThumb();
$image->renderImage();
?>[/php]
Merci pour l'aide.