Re: custom functions

From: Date: Wed, 20 Feb 2002 21:55:36 +0000
Subject: Re: custom functions
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2794@lists.php.net to get a copy of this message
I can't get the chance to do that, it just crashes the browser, however it works fine if I put it in a separate file and use include_php. George At 15:43 20/02/2002 -0600, Monte Ohrt wrote:
It looks like it is trying to do the right thing. put some debugging echos in there to see if is doing what you expect, or if the function is even being executed. chiefmonkey wrote: Here's the function function smarty_func_getimage($path) { $imagelist=array(); $handle=opendir($path); while(false !==($file = readdir($handle))) { if ($file !="." && $file !="..") { $ext=substr($file, -4); // if you wish to add .png to the list of files // uncomment the line below and delete the original line //if ($ext == ".jpg" || $ext==".gif" || $ext==".png") { if ($ext == ".jpg" || $ext==".gif") { array_push($imagelist, "$file"); } } } srand((double) microtime()* 1000000); $names=$imagelist; $rand_keys = array_rand($names,2); $adimage=$names[$rand_keys[0]]; $alt=substr($adimage,0,-4); $adimage="$path/".$adimage; $size=GetimageSize($adimage); $display="<img src=\"$adimage\" $size[3] alt=\"$alt\" />"; echo"$display"; closedir($handle); } Thanks for the help so far George


« previous php.smarty.general (#2794) next »