Hi all,
I want to view image file and save it to variable. it shows nothing in browser.
here is my code :
<?php
$files = "filename.gif";
echo exec('vi $files');
?>
view image file
Moderator: General Moderators
Re: view image file
Code: Select all
echo file_get_contents( "filename.gif" );-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: view image file
I think it depends on the browser...
IE is pretty good usually at automgaically handling MIME types from the file source itself. FireFox and other more compliant browsers might actually you require to set some headers first...
Look up header() on PHP web site I'm sure there are examples of how this is done.
Cheers,
Alex
IE is pretty good usually at automgaically handling MIME types from the file source itself. FireFox and other more compliant browsers might actually you require to set some headers first...
Look up header() on PHP web site I'm sure there are examples of how this is done.
Cheers,
Alex
Re: view image file
Try this:
It works 
Code: Select all
header('Content-Type: image/jpeg');
$files = file_get_contents("filename.jpeg");
echo $files;