PHP Thumb » Help & Bugs » Help

How do I do multiple thumbs

(3 posts)
  1. enatom
    Member

    How can I make multiple resizes of an uploaded image?

    what is the code like for making the multiple resizes of one uploaded image.

    Posted 11 months ago #
  2. Read documentation. Basically, you need a php file to process each thumb. It should look like this one:

    <?php
    require_once 'miniaturas/ThumbLib.inc.php';

    $fileName = (isset($_GET['filename'])) ? urldecode($_GET['filename']) : null;

    if ($fileName === null || !file_exists($fileName))
    {
    // handle missing images however you want... perhaps show a default image?? Up to you...
    }

    try
    {
    $thumb = PhpThumbFactory::create($fileName);
    }
    catch (Exception $e)
    {
    // handle error here however you'd like
    }

    $thumb->adaptiveResize(90, 90);

    $thumb->show();
    ?>

    Then, you call images this way:
    <img src="thumbs_maker.php?filename='.$path.'" class="thumb" alt="" />

    Each <img> call will return you a thumb.

    Posted 11 months ago #
  3. enatom
    Member

    cant i do this in the same file instead of another and use Get?

    Posted 11 months ago #

RSS feed for this topic

Reply

You must log in to post.