I do not understand because it gives this error I'm paying the parameters but still generates the error me here this class and use it as the line that gives me the error is 108
imagecopyresampled($image, $this->image, 0, 0, 0, 0, $value, $value_versus, $this->width, $this->height);
Here is the class
<?php class thumb {
var $image;
var $type;
var $width;
var $height;
//---Método de leer la imagen
function loadImage($name) {
//---Tomar las dimensiones de la imagen
$info = getimagesize($name);
$this->width = $info[0];
$this->height = $info[1];
$this->type = $info[2];
//---Dependiendo del tipo de imagen crear una nueva imagen
switch($this->type){
case IMAGETYPE_JPEG:
##Creamos la marca de agua =)
$imagen1 = imagecreatefromjpeg($name);
$imagen2 = imagecreatefromjpeg( "img/loguito.jpg" );
$imagen3 = imagecreatefrompng( "img/water.png" );
$x = intval( imagesx( $imagen1 ) - imagesx( $imagen2 ) ) / 1.02;
$y = intval( imagesy( $imagen1 ) - imagesy( $imagen2 ) ) / 1.02;
$x2 = intval( imagesx( $imagen1 ) - imagesx( $imagen3 ) ) / 1.02;
$y2 = intval( imagesy( $imagen1 ) - imagesy( $imagen3 ) ) / 1.02;
$x3 = intval( imagesx( $imagen1 ) - imagesx( $imagen3 ) ) / 10.02;
$y3 = intval( imagesy( $imagen1 ) - imagesy( $imagen3 ) ) / 10.02;
imagecopy( $imagen1, $imagen2, $x, $y, 0, 0, 80, 68 );
imagecopy( $imagen1, $imagen3, $x2, $y2, 0, 0, 400, 150 );
imagecopy( $imagen1, $imagen3, $x3, $y3, 0, 0, 400, 150 );
///imagejpeg( $imagen1, 'fotos/ttt'.basename($name) );
$this->image = imagejpeg($imagen1);
//$this->image = imagecreatefromjpeg($name);
break;
case IMAGETYPE_GIF:
$this->image = imagecreatefromgif($name);
break;
case IMAGETYPE_PNG:
$this->image = imagecreatefrompng($name);
break;
}
}
//---Método de guardar la imagen
function save($name, $quality = 100) {
//---Guardar la imagen en el tipo de archivo correcto
switch($this->type){
case IMAGETYPE_JPEG:
imagejpeg($this->image, $name, $quality);
break;
case IMAGETYPE_GIF:
imagegif($this->image, $name);
break;
case IMAGETYPE_PNG:
$pngquality = floor(($quality - 10) / 10);
imagepng($this->image, $name, $pngquality);
break;
}
imagedestroy($this->image);
}
//---Método de mostrar la imagen sin salvarla
function show() {
//---Mostrar la imagen dependiendo del tipo de archivo
switch($this->type){
case IMAGETYPE_JPEG:
imagejpeg($this->image);
break;
case IMAGETYPE_GIF:
imagegif($this->image);
break;
case IMAGETYPE_PNG:
imagepng($this->image);
break;
}
imagedestroy($this->image);
}
//---Método de redimensionar la imagen sin deformarla
function resize($value, $prop){
//---Determinar la propiedad a redimensionar y la propiedad opuesta
$prop_value = ($prop == 'width') ? $this->width : $this->height;
$prop_versus = ($prop == 'width') ? $this->height : $this->width;
//---Determinar el valor opuesto a la propiedad a redimensionar
$pcent = $value / $prop_value;
$value_versus = $prop_versus * $pcent;
//---Crear la imagen dependiendo de la propiedad a variar
$image = ($prop == 'width') ? imagecreatetruecolor($value, $value_versus) : imagecreatetruecolor($value_versus, $value);
//---Hacer una copia de la imagen dependiendo de la propiedad a variar
switch($prop){
case 'width':
imagecopyresampled($image, $this->image, 0, 0, 0, 0, $value, $value_versus, $this->width, $this->height);
break;
case 'height':
imagecopyresampled($image, $this->image, 0, 0, 0, 0, $value_versus, $value, $this->width, $this->height);
break;
}
//---Actualizar la imagen y sus dimensiones
//$info = getimagesize($name);
$this->width = imagesx($image);
$this->height = imagesy($image);
$this->image = $image;
}
//---Método de extraer una sección de la imagen sin deformarla
function crop($cwidth, $cheight, $pos = 'center') {
//---Hallar los valores a redimensionar
$new_w = $cwidth;
$new_h = ($cwidth / $this->width) * $this->height;
//---Si la altura es menor recalcular por la altura
if($new_h < $cheight){
$new_h = $cheight;
$new_w = ($cheight / $this->height) * $this->width;
}
$this->resize($new_w, 'width');
//---Crear la imagen tomando la porción del centro de la imagen redimensionada con las dimensiones deseadas
$image = imagecreatetruecolor($cwidth, $cheight);
switch($pos){
case 'center':
imagecopyresampled($image, $this->image, 0, 0, abs(($this->width - $cwidth) / 2), abs(($this->height - $cheight) / 2), $cwidth, $cheight, $cwidth, $cheight);
break;
case 'left':
imagecopyresampled($image, $this->image, 0, 0, 0, abs(($this->height - $cheight) / 2), $cwidth, $cheight, $cwidth, $cheight);
break;
case 'right':
imagecopyresampled($image, $this->image, 0, 0, $this->width - $cwidth, abs(($this->height - $cheight) / 2), $cwidth, $cheight, $cwidth, $cheight);
break;
case 'top':
imagecopyresampled($image, $this->image, 0, 0, abs(($this->width - $cwidth) / 2), 0, $cwidth, $cheight, $cwidth, $cheight);
break;
case 'bottom':
imagecopyresampled($image, $this->image, 0, 0, abs(($this->width - $cwidth) / 2), $this->height - $cheight, $cwidth, $cheight, $cwidth, $cheight);
break;
}
$this->image = $image;
}}?>
And this is how i use
$mythumb = new thumb();$mythumb->loadImage($path);$mythumb->resize($ancho, 'width');$mythumb->show();