Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    23

    Default jpg display problem

    Hi,

    I have a snippet of code that worked well on a server hosted by WESTHOST. I now have my own web server (iis 7) and now I cannot get the code to show anything.

    All this does is output a jpg. I use this code to send an image to FREEPDF. But works on its own to view an image called 784.jpg.
    Works fine on one server, now after I moved it, does not work in Win server 2003. Just get a blank screen now. The image file is in the root folde on both servers. Gotta be a simple answer to this one. GD is enabled in php.ini on both servers

    PHP Code:
    <?
    $path 
    '784.jpg';
    $src imagecreatefromjpeg($path);
    $newwidth 600;
    $newheight 600;
    $dest imagecreatetruecolor($newwidth,$newheight); 
    imagecopyresized ($dest$src0000$newwidth$newheightImageSX($src),ImageSY($src));
    // Output and free from memory
    header('Content-Type: image/jpeg');
    imagejpeg($dest);
    imagedestroy($src);
    imagedestroy($dest);
    ?>
    The whole idea behind this is to take an image that is above the root folder (not public) and to be able to display it
    Last edited by bcpaul; 12-18-2010 at 02:18 PM.

  2. #2
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,720

    Default

    What does the php error log say. That is where I would start. As a rule with php if you get a blank screen then you often have an error in the code and it would be written to the log if you have it enabled. You can find those settings in php.ini. Remember that paths in a windows environment are written with backslashes not forward slashes. If I where to guess on this, I would say that it has to do with your path to the image. The error log should tell you where it is looking for the image file.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Posts
    23

    Default

    yeah oops....missed the php after <?

    might explain why i was not getting any errors

    Thanks though!

  4. #4
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,720

    Default

    Oh man! Yep I do that every once in awhile myself. I can't believe I did not catch that for you.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  5. #5
    Junior Member
    Join Date
    Aug 2011
    Posts
    14

    Default

    I believe most people miss out on the "<?php " part too. I myself fell for this mistake. Makes me laugh sometimes. hehe.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •