You are here: Re: Generating images on the front page. « HTML « IT news, forums, messages
Re: Generating images on the front page.

Posted by Rik on 11/26/13 11:52

Dave Kelly wrote:
> Rik wrote:
>> I know that EV1 runs PHP because I have the SMF code running. I just
>>> need to check and see what hooks to scheduling they have.
>>
>> HTML: <img src="/path/to/dir/random.php" />
>>
>> random.php:
>> <?php
>>
>> $dh = opendir(dirname(__FILE__));
>>
>> $images = array();
>> $img_extensions = array('jpeg','jpg','png','gif');
>>
>> while (($file = readdir($dh))!==false){
>> if(is_file(dirname(__FILE__).'/'.$file)){
>> preg_match('/([^.]*)$/si',$file,$matches);
>> if(in_array(strtolower($matches[1]),$img_extensions)){
>> $images[] = $file;
>> }
>> }
>> }
>> closedir($dh);
>> $chosen ='./'.$images[rand(0,count($images)-1)];
>> $size = getimagesize($chosen);
>> header("Content-type: {$size['mime']}");
>> readfile($chosen);
>>>
>>
>> Grtz,
>
> I did not intend for you to do my work for me, but since you were
> kind enough. THANK YOU.

No problem, pretty much cut'n'paste from existing code here, took less time
then trying to describe it :-).

Grtz,
--
Rik Wasmus

 

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

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