Lengthy client side image rendering

Asked

Viewed 51 times

2

I use on a web page images that are loaded from a field of type blob in the Firebird. The images open in a modal, fully loaded, that is, without using thumbnails, and when the user clicks on one of these images, the image is resized to a larger size and occupies the entire screen.

However this process to open the image is taking long, despite the file .png or another image format already loaded on the client side. I use php base64_encode, and this returns a huge text to be rendered in the element img on the client side, I believe this is the case, but I found no other way than to display to the user what the image is loading.

Screen:

inserir a descrição da imagem aqui

  • Why don’t you upload the image and save its link in the database ? save images in the database and dangerous, if the database corrupts you lose the images and every time you go to call a photo is a request to the database.

  • There is no way to make the load faster without storing it in the computer but in the database?

1 answer

1


In your application’s Controller you can create a method to take the image from the database and call on src of your image in this way, for example, localhost/meuprojeto/controller/metodo?imagem={id_imagem}, this way it does not take long to render and there is no risk of crashing the user’s browser.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.