debug =0; $db->Connect($server, $user, $password, $database); $ID_foto =$_GET['ID']; $rs_categ=$db->Execute("SELECT * from produse where id=$ID_foto"); $nume_poza=$rs_categ->fields["poza"]; if($nume_poza=="") $nume_poza="-"; $id_produs = $_GET['ID']; $image_dir="../poze_produse"; $images=array(); $image_file=""; $max=229; if ($image_dir != "") { $d = dir($image_dir); $image_file = $image_dir."/".$nume_poza; if(!file_exists($image_file)) { $image_file="../images/sigla1.jpg"; $max=115; } $srcimg = imagecreatefromjpeg($image_file); } else $srcimg = imagecreate(100,50); $width = imagesx($srcimg); $height = imagesy($srcimg); $new_h = $height; $new_w = $width; if($width > $max) { $r1 = $height/$width; $new_h = $max*$r1; $new_w =$max; } if($new_h > $max) { $r = $width/$height; $new_w = $max*$r; $new_h =$max; } // note TrueColor does 256 and not.. 8 $dst_img = ImageCreateTrueColor($new_w,$new_h); $srcimg = imagecreatefromjpeg($image_file); imagecopyresampled ($dst_img, $srcimg, 0, 0, 0, 0, $new_w, $new_h, $width, $height); imagejpeg ($dst_img); imagedestroy ($dst_img); imagedestroy ($srcimg); ?>