Tim Thumb 用于外部主机/CDN
我正在客户网站上运行蒂姆拇指的库存副本。效果很好,但不支持外部主机的图片。我的客户使用亚马逊 CDN / Flickr 来存储他们网站上的所有图片,这不允许我动态调整大小。
有没有人找到解决这个问题的方法?
I'm running a stock copy of tim thumb on a clients website. Works great but does not support external hosts for the pictures. My clients uses an amazon CDN / Flickr for all of their websites pictures which doesnt allow me to resize on the fly.
Has anyone found a work around for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您有 PHP 5.0+,您应该可以通过将 CDN 地址添加到
$allowedSites
来使其正常工作。请参阅此处(第 556 行)。
If you've PHP 5.0+ you should be able to get it to work by adding the CDN address to
$allowedSites
.See here (line 556).
对于开发人员来说,使用 timthumb 动态生成缩略图非常快,但是当涉及到云托管或使用外部允许站点的 CDN 时,就有点过分了,因为缩略图将从应用程序主机而不是 CDN 传递。
一旦开始使用 CDN 或云存储,请考虑在将图像文件存储到云存储库时删除 timthumb 并利用缩略图的生成。就像 AWS s3 有一个事件触发器一样,您可以使用 lambda 函数来生成定义路径的缩略图,并相应地修改模板。是的,这似乎是一项工作,但最终网站用户会感受到差异,并且网站会表现得更好。
这不是一个解决方案,而是一个需要更多思考的建议。
Using timthumb for on the fly generation of thumbnails are pretty fast for a developer, but when it comes to cloud hosting or CDN using the external allowed sites would be an overkill as thumbnails would be delivered from the application host instead of CDN.
Once you start using the CDN or Cloud Store, consider dropping the timthumb and utilze generation of thumbnail when image file is stored into cloud repository. Like AWS s3 has an event trigger and you could use a lambda function to generate the thumbnails to a defined path, templates to be modified accordingly. Yea this seems to be some job, but eventually the site users will feel the difference and the site will perform better.
This is not a solution but a suggestion for more thought.