How to use PHP file in src tag of img?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ankitgupta871
    New Member
    • Oct 2011
    • 3

    How to use PHP file in src tag of img?

    Hi, i want to use php file in src tag of image tag.

    For example: i want to give the file name in the src tag of image as show below
    <img src="image.php" >

    In image.php file, i have echo the image named abc.jpg.SO, when i run the file, image.php, i am able to see the image

    But when i run the other file in which <img src="image.php" > is there, then i am not able to see the image, what shoudl i do in order to display the image?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    there could be a processing error in PHP, the script could be in another place, the MIME headers could be wrong (rather improbable).

    have you cleared the cache?

    Comment

    • ankitgupta871
      New Member
      • Oct 2011
      • 3

      #3
      what code should we do write in image.php?

      Comment

      • ankitgupta871
        New Member
        • Oct 2011
        • 3

        #4
        header("Content-type: image/jpeg");
        $image = "image.jpg" ;
        echo file_get_conten ts("$home/support/img/$image");

        it works but when i send the email, google reads that it is a image whereas some of the email marketing companies do it in the same way and google ios not able to read it and hence image is displayed irrespective of the fact that whether user opts show images or not

        Comment

        Working...