note 111535 modified in function.readfile by danbrown

From: Date: Mon, 04 Mar 2013 17:42:44 +0000
Subject: note 111535 modified in function.readfile by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193810@lists.php.net to get a copy of this message
I wasted days trying to figure this out before I found the problem was easily solved. I'm sure many of you out there have had similar problem when trying to use readfile to output images with a php file as the "src" of a "img" tag. It works fine "as is" in Firefox but not in IE, Safari or g.Chrome. I found hundreds of results on google all saying things like "there must be white space at the end of you code", "you need this header or that header". I couldn't believe what the solution was but here it is anyway! Remove the "Width" and "Height" attributes from your "img" tag --was-- I wasted days trying to figure this out before I found the problem was easily solved. I'm sure many of you out there have had similar problem when trying to use readfile to output images with a php file as the "src" of a "img" tag. It works fine "as is" in Firefox but not in IE, Safari or g.Chrome. I found hundreds of results on google all saying things like "there must be white space at the end of you code", "you need this header or that header". I couldn't believe what the solution was but here it is anyway! Remove the "Width" and "Height" attributes from your "img" tag To give credit I found the solution here: http://forums.devnetwork.net/viewtopic.php?f=1&p=553579 http://php.net/manual/en/function.readfile.php

« previous php.notes (#193810) next »