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

[eluser]Phil Sturgeon[/eluser]
If you are using MySQL and want to make the image sizes slightly smaller you can use COMPRESS() and UNCOMPRESS().

Then you want to make a controller like this:

Code:
<?php
class Media extends Controller

  function image($image_id)
  {
    // This will be image string
    $image_data = $this->images->get($image_id);
    
    $image = imagecreatefromstring($image_data);
  
    header('Content-Type: image/png');
    imagepng($image);
    imagedestroy($image);
    exit;
  }

}
?>

That should do the job.


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