Jump to content

What image types should I allow for uploads?


cooldude832

Recommended Posts

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        |

        |                                        |

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.