cooldude832 Posted August 14, 2007 Share Posted August 14, 2007 I'm making an image uploader that will put images into mysql. My question is what sort of images can I accept so that I can recreate from binary the given image. Also on a secondary note does anyone know how to get the Camera that took an images info off the binary or using GD? Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/ Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 I think this is all I need, let me know if it is $image_types = array("pjpeg", "pjpg", "png", "gif", "jpg", "jpeg"); Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324066 Share on other sites More sharing options...
Barand Posted August 14, 2007 Share Posted August 14, 2007 Have a look at the exif functions (JPEG or TIFF only) http://www.php.net/manual/en/ref.exif.php Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324073 Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 Thanks alot, does my array of allowed types look good. I know i've seen that module before just forgot its name. Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324079 Share on other sites More sharing options...
Barand Posted August 14, 2007 Share Posted August 14, 2007 I haven't seen "pjpg" types. If you want to process with GD Then the others are fine. If you want to extract metadata with exif then you are limited to the pjpeg, jpg, jpeg out of that set. GD doesn't support tiff. Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324087 Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 yeah so i thin i'll exclude the tiffs, I know ie uses the pjpg type idk if pjpeg is an old thing like I.E 4 or 5 or something but if they are I wanted to be safe. But yeah the camera add on is there if I have it otherwise i'll exclude it. Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324088 Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 Also whats the Max size (in mb) of a longblob entry, because I might be running into an issue if my images are greater than that if its 1.8mb like i think it is Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324095 Share on other sites More sharing options...
Barand Posted August 14, 2007 Share Posted August 14, 2007 I'd recommend storing the image files on the server and store the location in the db rather than store the images as blobs. Problem with tiffs is you can't manipulate them with gd (so no thumbnails etc). [pre] +---------- GD SET ----------+ | PNG, GIF | | | | +-------------------|------- EXIF SET ----+ | | PJPEG, JPEG, JPG | | | | | | +--------|-------------------+ TIFF | | | +-----------------------------------------+ Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324096 Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 I have an unlimited mysql storing ground and a limited server space so its a storage issue on them. Also I'm experimenting with ideas of database storage of images for when 6 comes out. I see longblob can be 4gb, but for some reason when i try an image over 4mb it crashes. (its not giving a max file size error just long load and dies, could it be reaching max time?) Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324100 Share on other sites More sharing options...
Barand Posted August 14, 2007 Share Posted August 14, 2007 If you are going to store them as blobs, first give some thought as to how you are going to re-display them. particularly if you want more than one per page Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324102 Share on other sites More sharing options...
cooldude832 Posted August 14, 2007 Author Share Posted August 14, 2007 echo "<img src=\"image.php?image_id=".$_GET['image_id']."\" alt=\"".$row['ImageName']."\" />"; image.php <?php require_once("functions.php"); // just so we know it is broken error_reporting(E_ALL); // some basic sanity checks if(isset($_GET['image_id']) && is_numeric($_GET['image_id'])) { //connect to the db connectSQL(); // get the image from the db $sql = "SELECT image FROM Images WHERE ImageID=".$_GET['image_id']; // the result of the query $result = mysql_query("$sql") or die("Invalid query: " . mysql_error()); // set the header for the image header("Content-type: image/jpeg"); echo mysql_result($result, 0); // close the db link mysql_close($link); } else { echo 'Please use a real id number'; } ?> needs a bit of optimization, but it will do (the header type needs to be more dynamic and a few other little things Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324127 Share on other sites More sharing options...
Barand Posted August 15, 2007 Share Posted August 15, 2007 No resizing required then? (That would disqualify tiffs.) Just display the images at whatever size they were uploaded. I guess I'm saying, for max flexibility, forget tiff. Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324136 Share on other sites More sharing options...
cooldude832 Posted August 15, 2007 Author Share Posted August 15, 2007 yeah i'm going to add more params to the image.php (via get) like max width or max height and then i'll trim it down to those params if they are set. The idea is I can take one uncompressed pile of biary and reproduce backgrounds in 800x600, 1080x whatever etc etc so i can resuse em for stuff like cell phones myspace desktops web pages etc etc Quote Link to comment https://forums.phpfreaks.com/topic/64939-what-image-types-should-i-allow-for-uploads/#findComment-324139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.