Execute($sql); if($result === false) die("failed - $sql"); if($result->RecordCount()) { $photo_array = $result->getRows(); $photo = $photo_array[0]; header('Content-Type: image/jpeg'); header('Content-Disposition: attachment; filename="product_image_big_'.$id.'.jpg"'); $img = new Image($photo['image_big'], true); echo $img->getUpdatedImage($w, $h, $percent, $constrain, $crop); } } elseif ($type == 'small') { $sql = "SELECT image_tiny FROM product_images WHERE id = $id"; $result = $db->Execute($sql); if($result === false) die("failed - $sql"); if($result->RecordCount()) { $photo_array = $result->getRows(); $photo = $photo_array[0]; header('Content-Type: image/jpeg'); header('Content-Disposition: attachment; filename="product_image_tiny_'.$id.'.jpg"'); echo($photo['image_tiny']); } else { header('Content-Type: image/gif'); $fp = fopen('../img/no_photo.gif', 'rb'); fpassthru($fp); fclose($fp); } }elseif ($type == 'medium'){ $sql = "SELECT image_thumbnail FROM product_images WHERE id = $id"; $result = $db->Execute($sql); if($result === false) die("failed - $sql"); if($result->RecordCount()) { $photo_array = $result->getRows(); $photo = $photo_array[0]; header('Content-Type: image/jpeg'); header('Content-Disposition: attachment; filename="product_image_thmb_'.$id.'.jpg"'); echo($photo['image_thumbnail']); } else { header('Content-Type: image/gif'); $fp = fopen('../img/no_photo.gif', 'rb'); fpassthru($fp); fclose($fp); } }else { if(empty($_GET['fullHtml'])){ $sql = "SELECT image_big FROM product_images WHERE id = $id"; $result = $db->Execute($sql); if($result === false) die("failed - $sql"); if($result->RecordCount()) { $photo_array = $result->getRows(); $photo = $photo_array[0]; header('Content-Type: image/jpeg'); header('Content-Disposition: attachment; filename="product_image_big_'.$id.'.jpg"'); echo($photo['image_big']); } } else { echo ' '; } } ?>