I am using phpMyAdmin and I have been trying to store input images directly on phpMyAdmin as a LARGEBLOB
type. However, it doesn’t upload properly and I have encountered errors such as
“Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
to allocate 2182024 bytes) in
D:xamppphpMyAdminlibrariesclassesError.php on line 373” or
“Server is away.”
I was pretty sure that I kept the images within the alloted limit (2046KiB) that a LARGEBLOB
could allow (I am trying to upload an image of 1MB) but somehow I couldn’t get to upload it somehow. So is there any other way to insert an image into phpmyadmin? or a remedy so I could keep using LARGEBLOB
s?
I have seen people replying to others’ posts about converting images to base64
and uploading them as strings but I am not sure how that works or how to do it.
Please shine some light on this matter. Thanks!
2
Answers
So I have looked into using
VARCHAR
on myphpMyAdmin
for my images and inputted there, the location of my image (i.e - images/car.jpg). And using this code -I was able to find loophole around using
BLOB
for images. This, however does not store the image on the database but the file location. Therefore you should not lose the folder.I don’t know why you are uploading blob image data to DB, the good and efficient method: