Изменение размера ширины и высоты изображений
I have content stored in mysql, as following:
<table width="210" cellspacing="1" cellpadding="1" border="0"> <tbody> <tr> <td><img width="513" height="680" align="left" alt="" src="/userfiles/image/pic.jpg" /></td> <td><img width="315" height="700" align="left" alt="" src="/userfiles/image/DSC_0389.JPG" /></td> <td><img width="580" height="320" align="left" alt="" src="/userfiles/image/ktxh.jpg" /></td> </tr> </tbody> </table>
When I load from db, PHP and display in html by PHP, there is no problem. The $content it be read from mysql($child_article[6]) and display in html by dynamic code: $sql_article = "select * from articles where approved=1 order by timestamp DESC"; @$childResult_article = general_query($sql_article); if ($child_article = mysql_fetch_row($childResult_article)) echo decode_data($child_article[6]). Now, I want all images, be displayed by fixed width and height as 200 X 200 AND TABLE BORDER = '0' ($content load from mysql by php and replace width and height of all images by 200 x 200 then echo $content to website)
Что я уже пробовал:
i tried, but can't result: $newWidth = 200; $newHeight = 200; $content = preg_replace( array('/width="\d+"/i', '/height="\d+"/i'), array(sprintf('width="%d"', $newWidth), sprintf('height="%d"', $newHeight)), $child_article[6]);
How do I solve this problem?
Member 14174664
любое тело может помочь мне!
пожалуйста