Daney11 Posted March 7, 2008 Share Posted March 7, 2008 Hey guys, Im using BBCode [im g]http://www.blah.com/image.jpg[/ img] text here etc If an image is bigger than my table on my website, it streches.... How do i make it so if the image between in image tags is bigger than x width, make it smaller? $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text); Thanks Link to comment https://forums.phpfreaks.com/topic/94967-bbcode/ Share on other sites More sharing options...
Daney11 Posted March 7, 2008 Author Share Posted March 7, 2008 would something like this work? $TextImg = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text); $Text = getimagesize($TextImg); Link to comment https://forums.phpfreaks.com/topic/94967-bbcode/#findComment-486458 Share on other sites More sharing options...
BlueSkyIS Posted March 7, 2008 Share Posted March 7, 2008 i would use getimagesize to get the size of the image. if the image is too big, i would adjust the width and height attributes of the IMG tag. actually, i might resize the image on upload instead, but it really depends on your system and preference. Link to comment https://forums.phpfreaks.com/topic/94967-bbcode/#findComment-486477 Share on other sites More sharing options...
Daney11 Posted March 8, 2008 Author Share Posted March 8, 2008 They dont upload images, images are all linked from another website. Link to comment https://forums.phpfreaks.com/topic/94967-bbcode/#findComment-486866 Share on other sites More sharing options...
Daney11 Posted March 8, 2008 Author Share Posted March 8, 2008 Or, make it so that the table doesnt break whatsoever... So if i have a string "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and it exceeds the table width, just let the string carry on past the table width... for example http://www.thesgl.com/wic/forums/topic/6136/page/1/ Link to comment https://forums.phpfreaks.com/topic/94967-bbcode/#findComment-486954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.