Tim Thumb 用于外部主机/CDN

发布于 2024-09-01 13:10:49 字数 237 浏览 4 评论 0原文

我正在客户网站上运行蒂姆拇指的库存副本。效果很好,但不支持外部主机的图片。我的客户使用亚马逊 CDN / Flickr 来存储他们网站上的所有图片,这不允许我动态调整大小。

有没有人找到解决这个问题的方法?

http://code.google.com/p/timthumb/

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?

http://code.google.com/p/timthumb/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抱猫软卧 2024-09-08 13:10:49

如果您有 PHP 5.0+,您应该可以通过将 CDN 地址添加到 $allowedSites 来使其正常工作。

function checkExternal ($src) {

    $allowedSites = array(
        'flickr.com',
        'picasa.com',
        'blogger.com',
        'wordpress.com',
        'img.youtube.com',
    );

请参阅此处(第 556 行)

If you've PHP 5.0+ you should be able to get it to work by adding the CDN address to $allowedSites.

function checkExternal ($src) {

    $allowedSites = array(
        'flickr.com',
        'picasa.com',
        'blogger.com',
        'wordpress.com',
        'img.youtube.com',
    );

See here (line 556).

香橙ぽ 2024-09-08 13:10:49

对于开发人员来说,使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文