Jump to content

runing a function inside an array.


blueman378

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.