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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.