PHP 图像大小调整性能
我正在为 php 开发一个图像调整大小脚本,并且有几个问题。
目前我正在拉取外部 URL 作为图像,并且真的不想存储将要调整大小的新图像在我的服务器上。 这就是我想要做的:
让脚本调整图像大小,然后将调整大小的图像动态编码为 base64。 现在我想知道的是,这会严重影响执行编码和使用 Base64 提供图像而不仅仅是 url 的性能吗? 或者存储图像比存储它的 base64 代码更好?
I'm working on an image resize script for php, and had a few questions..
Currently I'm pulling an external URL as the image, and don't really want to store the new image that is going to be re-sized on my server. Here is what I'm trying to do:
Have the script resize the image, than encode it the resized image in base64 on the fly. Now what I'm wondering is, would this be heavy on performance both doing the encode, and serving up the image with base64 rather than just the url? or would it be better to store the image rather than to store the base64 code for it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么要对调整大小的图像进行编码? 为什么不直接输出呢。 您不需要将其保存到文件中。
php 函数页面中的一些相关行:
要将其包含在页面中,您需要执行以下操作:
Why are you encoding the resized image? Why not just output it directly. You don't need to save it to a file.
Some relevant lines from php function page:
To include it in the page you would do something like: