Activity Stream
48,167 MEMBERS
62493 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1.     
    #1
    Pure Awesomeness!

    Default How to integrate Timthumb with wordpress

    Firts step - Adding the "get image" function to the functions.php file:
    ----------------------------------------------------------------------

    This code basically gives us the ability to fetch the first image on the post.

    Code: 
    function catch_that_image() {
      global $post, $posts;
      $first_img = '';
      ob_start();
      ob_end_clean();
      $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
      $first_img = $matches [1] [0];
    
      if(empty($first_img)){ //Defines a default image
        $first_img = "/images/default.jpg";
      }
      return $first_img;
    }
    Second step - Adding timthumb function:
    ------------------------------------------

    Code: 
    function PostThumbURL() {
        global $post, $posts;
        $thumbnail = '';
        ob_start();the_post_thumbnail();$toparse=ob_get_contents();ob_end_clean();
        preg_match_all('/src=("[^"]*")/i', $toparse, $img_src); $thumbnail = str_replace("\"", "", $img_src[1][0]);
        return $thumbnail;
    }
    Third step - Calling timthumb to generate the thumbs on your site:
    --------------------------------------------------------------------

    Original timthumb doesn't work with external hosts such as tinypic/lulzimg...etc, but here is a customized version I've been using
    that does . You can get it from here: http://paste2.org/p/1394246 - Make a new file and name it timthumb.php and upload it to your
    theme's folder.

    This is gonna be tricky if you're not into coding, but just try to find the file(s) that return the content on the index/category pages/
    archives...etc, then add this where you want the image to show up:

    Code: 
    <div class="post_thumb">
    <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><img src="http://yourdomain.com/path/to/timthumb.php?src=<?php echo catch_that_image() ?>&w=100&h=100&zc=1" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" /></a>
    </div>
    Now, go to the "Reading Settings" in the admin control panel of wordpress and tick "Summary" instead of "Full text". (Only do this if
    your theme shows up the whole post and doesn't have the option to swith to excerpts).
    Oh, and you need to create a cache folder in the same directory of the timthumb file and chmod it to 777.

    Fourth step - Adding some css code:
    --------------------------------------

    Get your style.css file and add this somewhere in there:

    Code: 
    .post_thumb {
        padding: 0 10px 10px 0;
        float:left;
    }
    Remember that you might have to play around with that code to make it look good on your own theme, but that should work fine. Well, congratulations, now you have thumbnails on your wordpress blog .

    Example from my site:



    PS: I didn't code the functions, I found them on google and made them work together, good luck with the setup.
    RT Reviewed by RT on . How to integrate Timthumb with wordpress Firts step - Adding the "get image" function to the functions.php file: ---------------------------------------------------------------------- This code basically gives us the ability to fetch the first image on the post. function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); Rating: 5



  2.   Sponsored Links

  3.     
    #2
    Member
    Hey Mr-R-T,

    I removed this part cause it wasn't displaying internal images on the server...

    Code: 
    $host = $_SERVER["HTTP_HOST"];
    $src = str_replace($host, "", $src);
    $host = str_replace("www.", "", $host);
    $src = str_replace($host, "", $src);


    Btw why did you turn off cache check?

  4.     
    #3
    Member
    Website's:
    wrzscene.info watchfreetvseriesonline.com
    i tried this but had problems, can anyone help out here

    http://www.besthostingforums.com/showthread.php?t=82831

  5.     
    #4
    Member
    The script works for external sources, but I found out its not working on images hosted on the server itself. Like I said above, I just removed this one:

    Code: 
    $host = $_SERVER["HTTP_HOST"];
    $src = str_replace($host, "", $src);
    $host = str_replace("www.", "", $host);
    $src = str_replace($host, "", $src);
    I also enabled cache handling and added some site filtering so it would be more secure

  6.     
    #5
    Pure Awesomeness!
    ^ Care to share the improved one?



  7.     
    #6
    Member
    Website's:
    adultrls.org tankibazz.com niloy.net
    Thanks For The Great Tips.

  8.     
    #7
    Member
    Not really a php coder so my codes are really messy

    But you can secure it a little by storing your sites in an array and doing something like this:

    Code: 
    strpos($src, $mysites);
    Which would return a boolean true or false if it has detected your designated sites or not...

    But really I don't think this is secure as there are other ways to work around it. I'm still finding a better secure solution for the designated urls

  9.     
    #8
    Banned
    here's the code in my functions.php file..



    I don't really get Step 2. is it in timthumb.php? or stil in functions.php? Added timthumb.php in my theme's folder. chmod is 644..

    also I don't really get where to put this:


    Edit my Reading settings change it to summary and edited my style.css

    but still not working..

    any help please.

  10.     
    #9
    Pure Awesomeness!
    Please post your site Ryza.

    Edit: and the second step goes in ur functions.php file.



  11.     
    #10
    Banned
    where should I put this code RT?


Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Timthumb Not Working
    By msk19994 in forum Server Management
    Replies: 4
    Last Post: 25th Oct 2012, 05:24 AM
  2. Replies: 7
    Last Post: 24th Oct 2011, 06:20 AM
  3. [Hiring] Integrate phpbb with wordpress
    By starme in forum Completed Transactions
    Replies: 6
    Last Post: 23rd Feb 2011, 03:24 PM
  4. How to add TimThumb in WordPress?
    By Palooo 2009 in forum Wordpress
    Replies: 0
    Last Post: 12th Jan 2011, 04:40 PM
  5. [Hiring] Integrate Wordpress Blog
    By Czechi in forum Completed Transactions
    Replies: 1
    Last Post: 21st Jul 2010, 07:20 PM

Tags for this Thread

BE SOCIAL