SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    image display problem

    please have a look on the following code, which i cannot display the image vr.jpeg

    <?php
    $result_final = "";
    $filename = 'vr.jpeg';
    $images_dir = 'photos';
    $result_final .= "<img src='".$images_dir. "/thumb_".$filename."' />&nbsp;&nbsp;";
    //$result_final .= "<img src='"$filename"'>";
    // Final Output
    echo <<<__HTML_END
    <html>
    <head>
    <title>Lets upload Dives</title>
    </head>
    <body>
    <table width='99%' border='0' align='center' style='width: 99%;'>
    <tr>
    <td>
    <p>&nbsp;</p>
    </td>
    </tr>
    $result_final
    <tr>
    <td>
    <p>&nbsp;</p>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?>


    please help to tell me what is the actual problem.

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Broken markup; there are no <tr> <td> tags around the image.
    Saul

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have put the tag around the image, but i still cannot see the image,
    i have confirm that the image is inside the folder photos.
    please help me.

    code as below :
    <?php
    $result_final = "";
    $filename = 'vr.jpeg';
    $images_dir = 'photos';
    print $filename;
    print $images_dir;
    $result_final .= "<img src='".$images_dir. "/thumb_".$filename."' />&nbsp;&nbsp;";
    //$result_final .= "<img src='"$filename"'>";
    // Final Output
    echo <<<__HTML_END
    <html>
    <head>
    <title>Lets see photo</title>
    </head>
    <body>
    <table width='99&#37;' border='0' align='center' style='width: 99%;'>
    <tr>
    <td>
    <p>&nbsp;</p>
    $result_final
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?>

    thank you

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    photos/thumb_vr.jpeg?

    Is this page opened from the root or from deeper in the hierarchy?

    try:
    Code:
    <img src='/".$images_dir. "/thumb_".$filename."' />&nbsp;&nbsp;
    Saul

  5. #5
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    much appreciate for you help but even with the / infront of the img src, the page still cannot display the image.
    i have both file thumb_vr.jpeg and vr.jpeg in the subdirectory 'photos' folder.
    i just want to try to load the image from the folder before i go futher to loop from database to load the image, but simple load and display also not working.
    please give me advice what i have done wrong, or give me any advice how should i debug to check the error.

    thank you

  6. #6
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The html output should be OK, as it seems, but you can double check it, if the image path is correct.

    Do you have this online? If so, post a link or PM it to me.
    Saul

  7. #7
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's easier to diagnose this sort of thing when you provide all three:

    1. The php code.
    2. What that code outputs.
    3. What you want that code to output.

    Feel free to trim 2 and 3 down to the <img />
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  8. #8
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i try to cut it simple, remove the folder , change the filename to vr.jpeg and copy to root directory. but with the following code, i still cannot view the image, the output display a blank page with a x on a image box.
    my code as below. i'm pretty sure that the file vr.jpeg is inside the root directory, what is the reason i can't see the image ?

    my code as below :

    <?php
    $result_final = "";
    $filename = 'vr.jpeg';
    $result_final .= "<img src='".$filename."' />&nbsp;&nbsp;";
    // Final Output
    echo <<<__HTML_END
    <html>
    <head>
    <title>Lets see photo</title>
    </head>
    <body>
    <table width='99&#37;' border='0' align='center' style='width: 99%;'>
    <tr>
    <td>
    $result_final
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    __HTML_END;
    ?>

    could it be we cannot output the image to html ?
    any reason ?
    please help, simple coding, but i can't get the result....
    all guru, please advice, much much appreciate...

  9. #9
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Are the images enabled on your browser?
    Saul

  10. #10
    SitePoint Guru
    Join Date
    Feb 2004
    Location
    Oregon
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did you upload the image in binary format?
    success is not by chance, it is by choice.

  11. #11
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Get php out of the equation.

    Just put a static tag on the page and see if that displays the image.

    <img src="whatever.jpg" />
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  12. #12
    SitePoint Zealot
    Join Date
    Nov 2006
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh yes... working now, simple, i just change the filename extension from jpeg to jpg, all guys, thank you very much for your help..


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
  •