I'm while using readfile function to see image files. It really works generally except when a picture is situated inside a directory with htaccess file.

Here's a good example:

header("Content-type: image/jpeg");
ob_clean(); // clean output buffer
flush(); // flush output buffer 

The htaccess is situated within the directory and appears such as this:

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]

In whatever way ways to get for this? The htaccess file should be there since the web application for the reason that folder needs results.

Why don't you browse the file from the filesystem rather than studying the web server?


What's most likely is your images read permissions for apache but no read permissions for whomever PHP runs as.

Try setting the permissions from the image to 0644.

RewriteCond %{REMOTE_ADDR}=""

Use REMOTE_ADDR like a new RewriteCond before others to skip them. Because you professional code is local it will likewise be from 127...1 and really should undergo nicely.