Jump to content

Recommended Posts

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?

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.

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.

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        |

        |                                        |

        +-----------------------------------------+

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?)

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.