Hello, I have a messagebox which converts bbcode to html. What i'm trying to do is deturmine if a remote image is over x pixels and then downsize it. What i have is this (below). But for some reason it's putting the whole message in the remote size function instead of just the image url. Can someone have a look. the message is stored in $c.
PHP Code:
$imagepath = preg_replace("/\[img\](.+?)\[\/img\]/", "\\1", $c);
$imageInfo = getimagesize($imagepath);
$width = $imageInfo[0];
$height = $imageInfo[1];
if ($width >= 1300){
$width = (20 / 100) * $width;
$height = (20 / 100) * $height;
} else {
$width = $width;
$height = $height;
}
//BBcode
$c = preg_replace('/\[img\]/', '<a href="' . $imagepath . '" target="_blank" border="0"><img src="', $c);
$c = preg_replace('/\[\/img\]/', '" width="' . $width . '" height="' . $height . '"></a>', $c);
Thanks.