[英]Creating Thumbnails with GridFS + MongoDB + PHP
I'm creating a site where a client who will be selling his photography which he sells a lot of it and will probably get quite a bit of traffic. 我正在创建一个网站,客户将出售他的摄影作品,而他出售了很多摄影作品,并且可能会吸引大量的访问量。 Probably around 2k-5k uniques a day.
每天大概有2k-5k唯一身份。 I'm using MongoDB with PHP and I read i should use GridFS to store these large files.
我将MongoDB与PHP结合使用,我读到我应该使用GridFS来存储这些大文件。 Upwards of 2MB-5MB photos, but obviously BW will be extremely spendy (im on cloud hosting) and loading of of these images will make page loads take forever.
上载2MB-5MB的照片,但显然BW会非常花钱(即时通讯在云托管上),并且这些图像的加载将使页面加载永久化。
So, how do I create thumbnails with GridFS in PHP and MongoDB? 那么,如何在PHP和MongoDB中使用GridFS创建缩略图? I Googled it and I can't seem to find any real information except people pointing to: http://www.php.net/manual/en/class.mongogridfs.php
我用Google搜索了它,但除了指向的人,我似乎找不到任何真实的信息: http : //www.php.net/manual/en/class.mongogridfs.php
but im not sure what to do with that information. 但我不确定该怎么做。 Do I need to (i hope not, this would be sort of messy):
我是否需要(我希望不是,那会有点混乱):
Upload -> store original -> use GD Lib to resize original -> resized image to GridFS as a meta value to the original image? 上载->存储原始文件->使用GD Lib调整原始文件的大小->将图像调整大小到GridFS作为原始图像的元值?
在使用GD2将其保存到MongoDB之后,我最终只创建了自己的缩略图,然后将缩略图以及完整尺寸保存下来。
One thing I did was inside a try {} catch 我所做的一件事是尝试尝试{}
if some exception happens (gd fails, mongo fails, etc...) then you remove the files so you don't waste storage. 如果发生某些异常(gd失败,mongo失败等),则可以删除文件,以免浪费存储空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.