![]() |
displaying BLOB data from DB - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: displaying BLOB data from DB (/showthread.php?tid=18563) Pages:
1
2
|
displaying BLOB data from DB - El Forum - 05-11-2009 [eluser]junaids[/eluser] hi. i successfully stored images into the DB, but still have problem with max size of images upload. now i want to retrieve images from the DB. any idea? displaying BLOB data from DB - El Forum - 05-11-2009 [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 That should do the job. displaying BLOB data from DB - El Forum - 05-11-2009 [eluser]umefarooq[/eluser] to make it more general also save content-type of the image in database also so its easy for you which type of image you have to create, either jpg,png or gif or while saving only take specific type of images displaying BLOB data from DB - El Forum - 05-11-2009 [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) { Etc. You can also add a default in there to use whatever $ext is, or fail with an error/validation message. displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]junaids[/eluser] should i call this function in the view where i have to show the image? displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]Colin Williams[/eluser] It will be the src attribute of an img tag. The controller shows the image. It is the image. displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]junaids[/eluser] here my controller Code: function image() and here the view where i m displaying the image. <img > no image is displayed. any idea? displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]junaids[/eluser] sorry the image code in the view is, Code: <img > displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]junaids[/eluser] [code]img src = <?=base_url()."user/image"?> displaying BLOB data from DB - El Forum - 05-12-2009 [eluser]junaids[/eluser] anybody home!!!!! |