The MU forums have moved to WordPress.org

timthumb.php not working (3 posts)

  1. madfastride
    Member
    Posted 11 years ago #

    I need to adjust the image size on certain pages only. If my client uses an image with a width of 600px on their post it should show properly on the single.php file but only 450px wide on any kind of list page.

    I'm planning on using timthumb.php to do this. I've read all the forum posts on this but I cant seem to splice the blog.dir/'.$blog_id.' into my images src so this works with WPMU. Here is my regular expression.

    $pattern = "/<img(.*?)src=('|\"){0,1}(https?\:)\/\/([A-Za-z0-9_\.\~\:-]*?)([A-Za-z0-9\/_\.\~\:-]*?)(\.bmp|\.gif|\.jpg|\.jpeg|\.png)('|\"){0,1}([^\>]*?)>/i";
    	$replacement = '<img src="'.get_bloginfo('url').'/wp-content/plugins/psir/timthumb.php?src=$3//$4/blog.dir/'.$blog_id.'$5$6&w=150&h=200&zc=0">';
    	$content = preg_replace($pattern, $replacement, $content);

    outputs the following:

    <img src="http://oregon.cyclingaction.com/wp-content/plugins/psir/timthumb.php?src=http:///blog.dir/3oregon.cyclingaction.com/files/2009/10/P3080045-1024x768.jpg&w=150&h=200&zc=0">

    So the piece I want to splice in is following the "http://" not the ".com"

    Any suggestion would be helpful

  2. harvknight
    Member
    Posted 11 years ago #

    Hi Mad,

    try this one http://www.binarymoon.co.uk/2009/10/timthumb-wordpress-mu/

    also try to put the timbthumb.php to root folder (ex: public_html/script/timthumb.php)

    it works for me.

  3. junglequeen
    Member
    Posted 10 years ago #

    I am not a programmer – just an HTML coder, and for the last 24 hours I’ve been trying to fix this timthumb.php issue. I changed server permissions and that didn’t help, I fiddled with codes and that didn’t help. The final solution (I think) was downloading the version of timthumb.php from http://timthumb.googlecode.com/svn/trunk/timthumb.php , changing the folder permissions back from 777 to 755 and sticking by the designer's instructions for the default post Key and URL. I am using Wordpress version 2.9.

    The blog displays fine in Firefox and Crazy but I’ve got some issues with IE – maybe need an upgrade … so what's new.
    Patricia
    junglequeen

About this Topic

  • Started 11 years ago by madfastride
  • Latest reply from junglequeen