SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Ottawa, Ont. Canada
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PROBLEM WITH PHP & img src

    Hello

    I had a program using PHP 4.3 and Apache 2 that worked.

    When I setup PHP 5 and Apache 2 on a different hard drive the program does not show the image.

    Can anyone help


    Here is the code:

    Program 1:

    <?

    print '<img src="image.php">';
    print '</p>';
    print '<input type="text" name="textimage">';
    print '</p>';


    ?>



    IMAGE.PHP

    <?php
    session_start();

    $randString = $_SESSION['randString'];

    // Header( "Content-type: image/png");
    Header( "Content-type: image/jpeg");

    $text = $randString;

    $fonts = array(2,3,4,5);

    $fHeight=10;
    $fWidth=10;
    $imagename = "reg_image.jpg";

    $image=imagecreatefromjpeg($imagename);

    $iHeight = ImageSY($image);
    $iWidth = ImageSX($image);
    $xPos=0;

    $r=38;
    $g=38;
    $b=38;
    $length = $fWidth * strlen($text);

    $xPos = floor(($iWidth-$length)/2);

    $fColor = ImageColorAllocate($image,$r,$g,$b);

    srand ((float)microtime()*1000000);
    $yStart=floor($iHeight/2)-$fHeight;
    $yEnd=$yStart+$fHeight;
    $yPos=range($yStart,$yEnd);
    for ($strPos=0;$strPos < $length; $strPos++) {
    # shuffle($fonts);
    shuffle($yPos);
    ImageString($image,
    $fonts[1],
    $xPos,
    $yPos[0],
    substr($text,$strPos,1),
    $fColor);
    $xPos+=$fWidth;
    }

    /* render image */
    // ImagePNG($image);
    ImageJPEG($image);

    /* cleanup memory */
    ImageDestroy($image);
    ?>

  2. #2
    Non-Member
    Join Date
    Oct 2004
    Location
    Net
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Copy the image to the new hard drive.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Ottawa, Ont. Canada
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PROBLEM WITH PHP & img src

    Hello

    The whole set of files, all pictures and programs were copied over. The problem is that PHP does not seem to open the image.php program. I have all the files in the same directory. So it is not a bad path.

    I have the same setup using PHP 4.3 and it works fine.
    Last edited by phall472; Oct 23, 2004 at 19:10.


Bookmarks

Posting Permissions

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