WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Recent Posts Widget
Tim Thumb and AWS S3 (6 posts)

  1. David Henry
    Member
    Posted 1 year ago #

    HI Guys,

    A great plugin that I use lots but in this case I need it to pull the thumbs from Amazon, this is causing a problem. The error is...

    You may not fetch images from that site. To enable this site in timthumb, you can either add it to $ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.

    But where would I set $ALLOWED_SITES, I'm no programmer so am baffled.

    Any help greatly appriciated.

    David

    http://wordpress.org/extend/plugins/advanced-recent-posts-widget/

  2. Patrick Rauland
    Member
    Posted 1 year ago #

    Hi David,

    I'm not familiar with this plugin at all nor with that error message but I do know that there was a recent TimThumb security risk so Amazon might be preventing you from doing anything to it.

  3. faina09
    Member
    Posted 1 year ago #

    I'm happy to post the solution!!
    WHAT WAS WRONG: the issue is only when using multisite network configuration; this is why thumb.php used by the plugin identify as a 'local file' images that can be fetched only using a full URL, due to rewrite rules in multisite.

    THE SOLUTION:
    (unfortunatly) you need to edit the file plugins\advanced-recent-posts-widget\timthumb\thumb.php
    in this way:
    - line 34
    if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', TRUE);
    - comment out line 212:
    //$this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src);

    ...or download modified file from here: http://coste.mypressonline.com/wp/other-wp-plugin-fixed/
    NOTE: .zip extension is dummy; rename in thumb.php and copy over existing file in your (..)plugins\advanced-recent-posts-widget\timthumb\ directory

    Please let me know if this solve the problem!!

  4. David Henry
    Member
    Posted 1 year ago #

    thanks, I'll give that a go now!

  5. faina09
    Member
    Posted 1 year ago #

    After studing a bit TimThumb web site, I found a better solution:
    added a function in advanced-recent-posts-widget.php

    if(!function_exists('get_image_path')):
    /**
     * for TimThumb script working with WordPress Multisite (formerly WordPress mu)
     * http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/
     */
    function get_image_path ($theImageSrc) {
    	if (isset($blog_id) && $blog_id > 0) {
    		$imageParts = explode('/files/', $theImageSrc);
    		if (isset($imageParts[1])) {
    			$theImageSrc = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
    		}
    	}
    	return $theImageSrc;
    }

    and call it adding this line:

    $thumbnail[0] = get_image_path($thumbnail[0]);

    before using thumbnail[0].

    You can download modified plugin from here: http://coste.mypressonline.com/wp/other-wp-plugin-fixed/

  6. cybentizen
    Member
    Posted 1 year ago #

    I updated the code with this code and tim thumb isn't working more... but this sorted out my issue

    <img src="<?php echo $thumbnail[0] ?>" alt="<?php the_title_attribute(); ?>" width="<?php echo $thumb_w; ?>" height="<?php echo $thumb_h; ?>" />

    You can set the image size in the widget.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags