Reply to Re: Show image img src=img.php?img=1.jpg help

Your name:

Reply:


Posted by b007uk on 05/16/06 14:33

RainCT wrote:
> Can you copy all the code?

Sure, here it is:

<?php
session_start();
$dir = session_id();

if ($_REQUEST['img'])
{
$showfile = "./temp/$dir/".$_REQUEST['img'];

if (file_exists($showfile))
{
header("content-type: image/jpeg");
header('Content-Length: ' . filesize($showfile));
header("Content-Disposition: inline; filename=$showfile");
readfile($showfile);
}
}
echo "<img src='?img=1.jpg'>";
?>

If i keep session_start() "Save picture as" detects image as
untitled.bmp, if i delete
session_start() - everythng is fine, it is detected as jpeg, but i need
session_id(), so i have to start session...
And, i read somewhere in this group that i should add ini_set, like
this:

<?php
ini_set('session.use_cookies', '0');
ini_set('session.cache_limiter', '');
ini_set('session.cache_expires', '');
session_start();
$dir = session_id();
.....

When i do that the image type is detected correctly as jpeg, but the
file name is not, its named as the script, showimg.jpg,
filename=$showfile" is not working for some reason. But i guess its
good enough, it would be nice to detect the file name as well though

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация