Simulator
Ever since the crash, and sometimes before it, my thumbnail code stoped working.
On #13 and #15 the information has been taking out
What happens is, it just shows the alt tag.... What should happen is, you request the image at thumb.php?id="PICTURE ID HERE" it takes the id and outputs the image... but all I get is the alt tag...
| Code: |
| <?php
$connection = mysql_connect($host,$user,$password) #13 or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection) #15 or die ("Couldn't select database"); $result2 = mysql_query("SELECT pic FROM pics WHERE id = '".mysql_escape_string($_GET["id"])."'"); $row = mysql_fetch_array($result2); extract($row); # Constants $mAX_WIDTH = 305; $mAX_HEIGHT = 260; # Get image location $image_path = $pic; # Load image $img = null; $ext = strtolower(end(explode('.', $image_path))); if ($ext == 'jpg' || $ext == 'jpeg') { $img = @imagecreatefromjpeg($image_path); } else if ($ext == 'png') { $img = @imagecreatefrompng($image_path); # Only if your version of GD includes GIF support } else if ($ext == 'gif') { $img = @imagecreatefromgif($image_path); } # If an image was successfully loaded, test the image for size if ($img) { # Get image size and scale ratio $width = imagesx($img); $height = imagesy($img); $scale = min($mAX_WIDTH/$width, $mAX_HEIGHT/$height); # If the image is larger than the max shrink it if ($scale < 1) { $new_width = floor($scale*$width); $new_height = floor($scale*$height); # Create a new temporary image $tmp_img = imagecreatetruecolor($new_width, $new_height); # Copy and resize old image into new image imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagedestroy($img); $img = $tmp_img; } } # Display the image header("Content-type: image/jpeg"); imagejpeg($img); imagedestroy($image_file); imagedestroy($img); ?> |
On #13 and #15 the information has been taking out
What happens is, it just shows the alt tag.... What should happen is, you request the image at thumb.php?id="PICTURE ID HERE" it takes the id and outputs the image... but all I get is the alt tag...
