开发者

Tim Thumb for an External Host / CDN

I'm running a stock copy of tim thumb on a clients website. Works great but does not support external hosts for the pictures.开发者_StackOverflow社区 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/


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜