Results 1 to 4 of 4

Thread: Access Image Files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Access Image Files

    When I am accesing image by following code it will be succedded.

    <?php

    echo getcwd()."/zodiac/Gemini.jpg";

    ?>

    But when I am accesing the following code then after "hello", the image is not coming, instead alphaneumeric characters are coming.

    <?php

    echo "hello <br>";
    echo getcwd()."/zodiac/Gemini.jpg";

    ?>

    Please show me the reason and rewrite the code.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Access Image Files

    Are you telling us that the first script actually results in the browser displaying the image? I don't believe it.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Access Image Files

    an image is a data stream, use file_get_contents() to read the file and then output it. Make sure you send the right MIME type header first.

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Access Image Files

    Quote Originally Posted by systech44
    When I am accesing image by following code it will be succedded.
    No it won't, it will print the path of the file.

    Quote Originally Posted by systech44
    But when I am accesing the following code then after "hello", the image is not coming, instead alphaneumeric characters are coming.
    You cannot snd text with an image. You are not even opening the images. All you'll get is the path of the images printed on the page.

    If you want to know how to display text and an image, I suggest you learn HTML.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width