Error:
Código PHP:
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 178
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 179
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 180
Warning: getimagesize(../img/tmp/26008.jpg): failed to open stream: No such file or directory in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 290
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 178
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 179
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 180
Warning: getimagesize(../img/tmp/26008_medium.jpg): failed to open stream: No such file or directory in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 290
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 178
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 179
Warning: Division by zero in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 180
Warning: getimagesize(../img/tmp/26008_orig.jpg): failed to open stream: No such file or directory in c:archivos de programaeasyphp1-8wwwpassionadmininchft_image.php on line 290
Código PHP:
if($desired_width != "*") $mult_x = $desired_width / $this->image_original_width;
if($desired_height != "*") $mult_y = $desired_height / $this->image_original_height;
$ratio = $this->image_original_width / $this->image_original_height;
if($desired_width == "*"){
$new_height = $desired_height;
$new_width = $ratio * $desired_height;
}elseif($desired_height == "*"){
$new_height = $desired_width / $ratio;
$new_width = $desired_width;
}else{
if($mode=="-"){
if( $this->image_original_height * $mult_x < $desired_height ){
//image must be smaller than given $desired_ region
//test which multiplier gives us best result
//$mult_x does the job
$new_width = $desired_width;
$new_height = $this->image_original_height * $mult_x;
}else{
//$mult_y does the job
$new_width = $this->image_original_width * $mult_y;
$new_height = $desired_height;
}
}else{
//mode == "+"
// cover the region
//image must be bigger than given $desired_ region
//test which multiplier gives us best result
if( $this->image_original_height * $mult_x > $desired_height ){
//$mult_x does the job
$new_width = $desired_width;
$new_height = $this->image_original_height * $mult_x;
}else{
//$mult_y does the job
$new_width = $this->image_original_width * $mult_y;
$new_height = $desired_height;
}
}
}
break;
case '0':
//fit the region exactly.
if($desired_width == "*") $desired_width = $this->image_original_width;
if($desired_height == "*") $desired_height = $this->image_original_height;
$new_width = $desired_width;
$new_height = $desired_height;
break;
default:
$q->exec('DELETE FROM sites WHERE id_sites = '.$lid);
die('Image type not valid.');
//$this->error($ERR["UNKNOWN_RESIZE_MODE"]." $mode");
break;
}
// OK here we have $new_width _height
//create destination image checking for GD2 functions:
if( $this->use_gd2 ){
if( function_exists("imagecreatetruecolor")){
$this->image_resized = imagecreatetruecolor($new_width, $new_height) or $this->error($ERR["GD2_NOT_CREATED"]);
}else {
$this->error($ERR["GD2_UNAVALABLE"]." ImageCreateTruecolor()");
}
} else {
$this->image_resized = imagecreate($new_width, $new_height) or $q->exec('DELETE FROM sites WHERE id_sites = '.$lid);
die('Image type not valid.');//$this->error($ERR["IMG_NOT_CREATED"]);
}
//Resize
if( $this->use_gd2 ){
if( function_exists("imagecopyresampled")){
$res = imagecopyresampled($this->image_resized,
$this->image_original,
0, 0, //dest coord
0, 0, //source coord
$new_width, $new_height, //dest sizes
$this->image_original_width, $this->image_original_height // src sizes
) or $this->error($ERR["GD2_NOT_RESIZED"]);
}else {
$this->error($ERR["GD2_UNAVALABLE"]." ImageCopyResampled()");
}
} else {
$res = imagecopyresized($this->image_resized,
$this->image_original,
0, 0, //dest coord
0, 0, //source coord
$new_width, $new_height, //dest sizes
$this->image_original_width, $this->image_original_height // src sizes
) or $this->error($ERR["IMG_NOT_RESIZED"]);
}
}
function output_original($destination_file, $image_type="JPG") {
return _output_image($destination_file, $image_type, $this->image_original);
}
function output_resized($destination_file, $image_type="JPG") {
global $lid;
$res = $this->_output_image($destination_file, $image_type, $this->image_resized);
if(trim($destination_file)){
$sz=getimagesize($destination_file);
$this->file_resized = $destination_file;
$this->image_resized_width = $sz[0];
$this->image_resized_height = $sz[1];
$this->image_resized_type_code=$sz[2];
$this->image_resized_html_sizes=$sz[3];
switch($this->image_resized_html_sizes){
case 0:
$this->image_resized_type_abbr = "GIF";
break;
case 1:
$this->image_resized_type_abbr = "JPG";
break;
case 2: