You are here: Re: upload file issue « PHP Programming Language « IT news, forums, messages
Re: upload file issue

Posted by Good Man on 04/17/07 19:33

Jerry Stuckle <jstucklex@attglobal.net> wrote in
news:4e-dnSRy5N3bZbnbnZ2dnUVZ_qiqnZ2d@comcast.com:


> You could do something like create a php file which serves the images
> from the other folder, but that's the hard way.

You can make it all fancy-like, or simple.... depending on what you
need. But if you have the GD library and you're set on keeping images
above the webserver, you can do something like this... I'll call this
file "imagedisplay.php";

<?php

/*
if you wanted, you could have the database figure out which image to get
based on a 'file key' or something, or another db call... for this
example, i'm putting the image name right in the code.
*/

$vImg = "donut.jpg";

header("Content-type: image/jpeg");
if(file_exists($vImg)) {
$img_handle = imagecreatefromjpeg($vImg) or die("");
ImageJpeg($img_handle);
}

?>

Voila.

In your code, it's just:

<img src="imagedisplay.php?vKey=xyydjaj" alt="My Image" />

 

Navigation:

[Reply to this 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

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