Hello people.. I have written a code that replaces IMG tags in a text with the HTML <img tag.. However, I faced a problem; Big images spoiled the layout of the page being viewed.
Is there anyway to limit the size of the image only when it's more than 300 wide and 400 high??
This is my code:

$Txt = $_POST['Text'];
$arrA = array('[img]','[/img]');
$arrB = array('<img src="','">');
$Txt = stri_replace($arrA,$arrB,$Txt);
echo $Txt;

So I want to set the size limits as: 300,400.

why dont you use the if condition.. oh yes you cant coz u have to replace many

You may need to use some JavaScript code.. I'll try to get it hopefully.

Wheres the code buddy
HELLO any body there??

This issue has to do with CSS; you can add the following to the style of the image:

max-width:????; /* You can also use percentage in the value*/

This property works on CSS2.
Hope it helps.

commented: Thanks for your effort +1

Finally!! Thank thee, lord!

You're very welcome, sir. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.