|
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]
|