PHP Thumb » Help & Bugs » Help

Instant resizing or multiple thumbnail creation? in both cases, Help!

(1 post)
  1. Birch
    Member

    Ok, this has been really a pain in the neck.

    I have a database made with MySQL and PHP. The script I used selects 1 row from the table, and displays the values in a table using echo. So I used the technique written in http://trac.gxdlabs.com/projects/phpthumb/wiki/Docs/BasicUsage#ShowingImages
    But, when the solution the docs say failed, I used various ways such as echo "<img src=\"thumb.php?file=".echo urlencode('/covers/komix$id.png')."\" />";, but I couldn't achieve it. When I tried to fetch the image with a img tag outside the php tags, I found out that the script show the exception error. No matter what I did,(ie ../s and directory changes) I could not get a result.

    the thumb.php file source:
    <?php

    $path = $_SERVER['DOCUMENT_ROOT'];
    $path .= "/scripts/thumb/ThumbLib.inc.php";
    require_once "$path";

    $fileName = (isset($_GET['file'])) ? urldecode($_GET['file']) : 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->resize(201, 283);
    $thumb->show();

    ?>

    Another problem is the thumbnail saving. I have 300+ pngs of a high quality and doing it manually is a nightmare. How can I do it?

    Thank you in advance for your help!

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.