php image resizing script (PHP Thumbnailer) is not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neovantage
    New Member
    • Aug 2008
    • 245

    php image resizing script (PHP Thumbnailer) is not working

    Hey geeks,
    I am using a script PHP Thumbnailer which resize image at run time. But it is not working in my case as i have integrated that script by studying it's documentation.

    Here is the URL where i am using his script.
    My URL

    and here is the script code i am using in my application
    Code:
    <img src="show_image.php?file=show_image.php?file=images%2Fproducts%2F1246358928.gif" />
    and the how_image.php file has the following code
    Code:
    <?php
    error_reporting(E_ALL);
    require_once 'lib/ThumbLib.inc.php';
    $fileName = (isset($_GET['file'])) ? urldecode($_GET['file']) : null;
    if ($fileName h3. 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(100, 100);
    $thumb->show();
    ?>

    and here is the URL from where i read this script help
    SCRIPT HELP URL

    it has heading name "Showing Images" which tells hwo to resize image dynamically.

    Kindly help me to sort out my problem.


    kind regards,
    Mohsin Rafique
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    $fileName h3. null
    that’s a rather strange condition… and I’m not a geek.

    It would be helpful, if you could describe the error, for I don’t have ‘Bock’ to search for it at length.

    and another thing, usually you handle errors when the exception is thrown and not before (that’s what the catch block is for)

    Comment

    • neovantage
      New Member
      • Aug 2008
      • 245

      #3
      Sir Dormilich,
      The problem is i am not getting error but it does also not showing the picture after resizing too. So what will be the problem then? Picture does exist too at that that path too.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        what image? I don’t see any image worth thumbnailing.

        Comment

        • neovantage
          New Member
          • Aug 2008
          • 245

          #5
          Pleas find the attached screenshot which shows the location of image not display in the page after using resizing script.

          Again this is the Live URL

          Also see in IE. Then you will find a cross icon image not displaying
          Attached Files

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            Also see in IE. Then you will find a cross icon image not displaying
            I can’t do that.

            Comment

            • neovantage
              New Member
              • Aug 2008
              • 245

              #7
              Should i give you my php script....?

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                maybe after I can reproduce the error (which is right now the problem).

                Comment

                • neovantage
                  New Member
                  • Aug 2008
                  • 245

                  #9
                  Sorry it works now. it was my fault
                  .
                  My image was save with the extention *.png and it was taking it as *.gif that is why it is nto showing the image. Thank you very much "Dormilich" . I am really very grateful to you.

                  Comment

                  • Dormilich
                    Recognized Expert Expert
                    • Aug 2008
                    • 8694

                    #10
                    you may have realized it earlier, if you would have checked the catch block.

                    a very simple example how to use Exceptions:
                    Code:
                    try {
                        $thumb = PhpThumbFactory::create($fileName);
                    }
                    catch (Exception $e) {
                        // e.g. print the error message
                        echo $e->getMessage();
                    }
                    of cause you don’t need to print the message, you can also let a mail script send the message to you.

                    Comment

                    Working...