olli460 Posted October 29, 2009 Share Posted October 29, 2009 Hello, Ive got about 20 text boxs with HTML code of images in them, I want to be able to change the width="250" to a value i specify, However all the widths are different so i cant just do a basic str_replace. Does anyone know a way i can do it. Link to comment https://forums.phpfreaks.com/topic/179531-changing-lots-of-different-widthheight-values/ Share on other sites More sharing options...
lemmin Posted October 29, 2009 Share Posted October 29, 2009 You could use regular expressions http://www.regular-expressions.info/ something like: $html = preg_replace("/(<img.+?width=\").+?(\")/", "$1 500$2", $html); Sorry, I edited that regex, it was wrong. Link to comment https://forums.phpfreaks.com/topic/179531-changing-lots-of-different-widthheight-values/#findComment-947317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.