Page is a not externally linkable
matthewamzn - 11:22 pm on Sep 21, 2008 (gmt 0)
$photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $thumb = imagecreatefromstring($photo); $vehicle_id = $_POST['vehicle_id'];
I'm trying to upload an image and it's thumbnail to my database. I'm stuck on resizing the image. This successfully uploads an image, but the resize fails.
$_FILES['file']['size']));
$width = imagesx($thumb);
$height = imagesy($thumb);
$thumb_height = 100;
$thumb_width = $width / $height * $thumb_height;
$thumbnail = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($thumbnail,$thumb,0,0,0,0,$width,$height,ImageSX($thumb),ImageSY($thumb));
$query = sprintf("INSERT INTO v_images(photo, file_ype, vehicle_id, thumbnail) VALUES
('%s', '%s', '%s', '%s')", $photo, $_FILES['file']['type'], $vehicle_id, $thumbnail);