我已经为我的应用程序中的一个东西的图像上传编写了图像处理。
我的应用程序将图像的原始副本保存到服务器,并在数据库中放置一个带有文件名和扩展名的条目。 (还有其他信息)。
在此之后,我将5个版本的图像(各种分辨率)保存到服务器,但我没有为这些添加数据库条目:
例如:
uploaddir + filename + "-1024" + extension uploaddir + filename + "-800" + extension uploaddir + filename + "-640" + extension uploaddir + filename + "-320" + extension uploaddir + filename + "-thumbnail" + extension所以这意味着我可以使用特定尺寸的图像(例如):
@Settings.UploadURL@fieldImage.File.UniqueName@ImageSizes.Thumbnail@fieldImage.File.Extension;听起来不错吗? 或者你认为我还应该针对所有图像尺寸创建数据库条目?
所以澄清一下:
我保存了一个具有唯一文件名和扩展名的数据库条目 我保存到服务器,各种不同的图像大小,其大小作为文件名的一部分添加 我有一个常量类,所以我可以添加它只显示我想要的大小的网址通过采用这种方法,您可以预见到将来会遇到哪些问题?
I have written the image crunching for the image upload of a thing in my application.
My application saves the original copy of the image to the server, and places an entry in the database with a file name and extension. (with other info too).
After this, I save 5 versions of the image (various resolutions) to the server but I do not put database entries in for these:
For example:
uploaddir + filename + "-1024" + extension uploaddir + filename + "-800" + extension uploaddir + filename + "-640" + extension uploaddir + filename + "-320" + extension uploaddir + filename + "-thumbnail" + extensionSo this means i can use specific sizes of the image (for example):
@Settings.UploadURL@fieldImage.File.UniqueName@ImageSizes.Thumbnail@fieldImage.File.Extension;Does this sound okay? Or do you think I should also create database entries against all image sizes?
So to clarify:
I save one database entry that has a unique file name and the extension I save to the server, various different image sizes with the size added as part of the file name I have a class with constants in so that i can add that to only show the url of the size i wantWhat issues can you foresee me having in the future by taking this approach?
最满意答案
保留条目可能是值得的。 如果没有别的,您可以稍后决定,如果原始图像质量太低,您希望逻辑不创建不同大小的图像。
假设你得到一张320像素的照片......你真的想尝试升级吗?
It might be worth keeping entries. If nothing else, you can decide later that you want logic to not create the different sized images if the original already is too low of quality.
Say you get a 320 px image... Do you really want to try and upscale that?
更多推荐
发布评论