0

I have a table in mysql database consisting of jpeg blob

i want to pull that blob and displayed it into a browser, how ever the blob size is to big making loading time very long

can PHP compress those blob before sending it to the browser and display it as base64_encode jpeg? if it can how ? please help me

  • 1
    Possible duplicate of [Resize image in PHP](https://stackoverflow.com/questions/14649645/resize-image-in-php) – Oleg Nurutdinov Jan 23 '19 at 12:19
  • 1
    Also, I don't know why you need to store your images in DB. In my opinion, firtsly, it better to compress images BEFORE you've uploaded it on your server. Second, I usual store images on server side (inside some directory) and insert only PATH to it in DB. But it's your choice. – Oleg Nurutdinov Jan 23 '19 at 12:22
  • JPEG is a compressed image format, you will not achieve much by attempting to compress it further. I would strongly recommend storing your pictures in a folder, and just storing a reference to the image in the db. – JoSSte Jan 23 '19 at 13:01
  • base64_encode ? NO base64 encoding doesn't compress rather it increases the file size https://stackoverflow.com/questions/4715415/base64-what-is-the-worst-possible-increase-in-space-usage – Vinay Jan 24 '19 at 03:54
  • I cant change the concept of the system since i am only run php script to create report...so changing blob into file path is not an option...how about making thumbnail?? Can php do it from blob? – Yoki Hardian Tenggara Jan 25 '19 at 01:01

0 Answers0