简体   繁体   中英

Storing large size (10MB) images in Mysql Local server

I actually am working on a website having heavy sized images. So while i'm trying to store those images in the Mysql table using LONGBLOB, it is still throwing up the error about the size. Once the images are stored in the database, I want to fetch them in the website using PHP.

Can anyone one tell me how to go about that and also if there are any other alternatives on storing the images in the database other than Mysql, that would be helpful.

Thank you in advance.

Regards

VG

Save yourself endless headaches, and store the file location in you database instead of a BLOB.

When you go to access it with PHP it is as simple as: query the DB and use the file location like so: <img src="{$dbResult['image']}" />

Storing images in database is bad practice. You shouldn't do like that. I invite you to read this article - Storing Images in DB - Yea or Nay? .

You can save images on your server and save their URI in database and then display them in similar way:

<img src="<?php echo $row['imageUrl']; ?>" alt="" />

Adding the image URL would be a better option in my case. Hope it will make the website more Optimized.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM