blueman378 Posted March 19, 2008 Share Posted March 19, 2008 hi guys well heres the code: <?php $post = $_POST['post']; //bbcode $patterns = array( "/\[img\](.*?)\[\/img\]/"); $replacements = array( //bbcode "<a href='\\1'><img border=0 src='\\1' height='100px' width='250px'></a>"); $post = preg_replace($patterns,$replacements, $post); echo $post; ?> obviously simplified, anyway that works fine, but what im wanting to do is have a function which checks the image source: list($width, $height) = getimagesize("image_name.jpg"); and then instead of having height='100px' width='250px' have if(.$width < 250) {echo "width='250px'"} elseif(.$height < 100) {echo "height='100px'"} but om not sure how to put all these together, any ideas? Link to comment https://forums.phpfreaks.com/topic/96853-runing-a-function-inside-an-array/ Share on other sites More sharing options...
lordfrikk Posted March 20, 2008 Share Posted March 20, 2008 You might want to use this function: http://uk.php.net/array_walk Link to comment https://forums.phpfreaks.com/topic/96853-runing-a-function-inside-an-array/#findComment-496859 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.