Welcome Guest, Not a member yet? Register   Sign In
displaying BLOB data from DB
#4

[eluser]Phil Sturgeon[/eluser]
I was going to write in a switch for that but decided it would take 1 minute too long. Storing the content type is always a good idea with images. :-)

Don't just save the extension either cause the variations can cause complications through your code. When you save it use a switch like:

Code:
switch($ext) {
  case 'jpg':
  case 'jpe':
  case 'jpeg':
    $type = 'jpeg';
  break;

  case 'xbmp':
    $type = 'bmp';
  break;

  case 'png':
  case 'gif':
    $type = $ext;
  break;

}

Etc. You can also add a default in there to use whatever $ext is, or fail with an error/validation message.


Messages In This Thread
displaying BLOB data from DB - by El Forum - 05-11-2009, 12:37 AM
displaying BLOB data from DB - by El Forum - 05-11-2009, 04:02 AM
displaying BLOB data from DB - by El Forum - 05-11-2009, 06:02 AM
displaying BLOB data from DB - by El Forum - 05-11-2009, 06:11 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 03:20 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 03:32 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 03:50 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 03:59 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 04:00 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 08:27 AM
displaying BLOB data from DB - by El Forum - 05-12-2009, 01:18 PM
displaying BLOB data from DB - by El Forum - 05-12-2009, 02:19 PM
displaying BLOB data from DB - by El Forum - 05-12-2009, 02:24 PM
displaying BLOB data from DB - by El Forum - 05-12-2009, 02:34 PM
displaying BLOB data from DB - by El Forum - 06-21-2009, 11:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB