Takze takto som si nakoniec cely ten script upravil
aa ked dam obrazok vacsi nez je povolene tak mi vypise toto:
Kód: Vybrať všetko
Warning: imagejpeg(): supplied argument is not a valid Image resource in /www/***/public_html/pridaj/admin.php on line 46
Warning: fread(): supplied argument is not a valid stream resource in /www/***/public_html/pridaj/admin.php on line 47
Warning: fclose(): supplied argument is not a valid stream resource in /www/***/public_html/pridaj/admin.php on line 48
Kód: Vybrať všetko
#nastavenia
$max_velkost = 2048;
$max_width = "500";
$max_height = "800";
$allowed_types = array("image/bmp","image/gif","image/pjpeg","image/jpeg","image/png");
if(isset($action)) {
#obrazky
$fp = fopen($obrazok1, "r");
$data = addslashes(fread($fp, filesize($obrazok1)));
fclose($fp);
$type = $obrazok1_type;
$imgfile = $obrazok1;
$fp2 = fopen($obrazok2, "r");
$data2 = addslashes(fread($fp2, filesize($obrazok2)));
fclose($fp2);
$type2 = $obrazok2_type;
$imgfile2 = $obrazok2;
list($width, $height) = GetImageSize($obrazok1);
list($width2, $height2) = GetImageSize($obrazok2);
#obrazok1
if($width < $max_width) {
$obrazok1final = $data;
} else {
#definovane zmensenie obrazku
$thumb_width = $max_width;
$thumb_height = $height - ($width - $max_width);
#image obrazku
$thumbimg = ImageCreateTrueColor($thumb_width,$thumb_height);
if($obrazok1_type == "image/png") { $thumbsource = imagecreatefrompng($imgfile);
} elseif($obrazok1_type == "image/gif") { $thumbsource = imagecreatefromgif($imgfile);
} elseif($obrazok1_type == "image/pjpeg" || $obrazok1_type == "image/jpeg") { $thumbsource = imagecreatefromjpeg($imgfile);
} elseif($obrazok1_type == "image/bmp") { $thumbsource = imagecreatefromwbmp($imgfile); }
imagecopyresized($thumbimg, $thumbsource, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height);
if(obrazok1_type == "image/png") { $fp3 = fopen(imagepng($thumbing), "r");
$obrazok1final = addslashes(fread($fp3, filesize($thumbing)));
fclose($fp3);
} elseif($obrazok1_type == "image/gif") { $fp3 = fopen(imagegif($thumbing), "r");
$obrazok1final = addslashes(fread($fp3, filesize($thumbing)));
fclose($fp3);
} elseif($obrazok1_type == "image/pjpeg" || $obrazok1_type == "image/jpeg") { $fp4 = fopen(imagejpeg($thumbing), "r");
$obrazok1final = addslashes(fread($fp3, filesize($thumbing)));
fclose($fp3);
} elseif($obrazok1_type == "image/bmp") { $fp3 = fopen(imagewbmp($thumbing), "r");
$obrazok1final = addslashes(fread($fp3, filesize($thumbing)));
fclose($fp3); }
#obrazok2
if($width2 < $max_width) {
$obrazok2final = $data2;
} else {
#definovane zmensenie obrazku
$thumb_width2 = $max_width;
$thumb_height2 = $height2 - ($width2 - $max_width);
#image obrazku
$thumbimg2 = ImageCreateTrueColor($thumb_width2,$thumb_height2);
if(obrazok2_type == "image/png") { $thumbsource2 = imagecreatefrompng($imgfile2);
} elseif($obrazok2_type == "image/gif") { $thumbsource2 = imagecreatefromgif($imgfile2);
} elseif($obrazok2_type == "image/pjpeg" || $obrazok2_type == "image/jpeg") { $thumbsource2 = imagecreatefromjpeg($imgfile2);
} elseif($obrazok2_type == "image/bmp") { $thumbsource2 = imagecreatefromwbmp($imgfile2); }
imagecopyresized($thumbimg2, $thumbsource2, 0, 0, 0, 0, $thumb_width2, $thumb_height2, $width2, $height2);
if(obrazok2_type == "image/png") { $fp4 = fopen(imagepng($thumbing2), "r");
$obrazok2final = addslashes(fread($fp4, filesize($thumbing2)));
fclose($fp4);
} elseif($obrazok2_type == "image/gif") { $fp4 = fopen(imagegif($thumbing2), "r");
$obrazok2final = addslashes(fread($fp4, filesize($thumbing2)));
fclose($fp4);
} elseif($obrazok2_type == "image/pjpeg" || $obrazok2_type == "image/jpeg") { $fp4 = fopen(imagejpeg($thumbing2), "r");
$obrazok2final = addslashes(fread($fp4, filesize($thumbing2)));
fclose($fp4);
} elseif($obrazok2_type == "image/bmp") { $fp4 = fopen(imagewbmp($thumbing2), "r");
$obrazok2final = addslashes(fread($fp4, filesize($thumbing2)));
fclose($fp4); }
}}}
Aka je tam chyba?
