1 tears_of_hate Nov 20, 2007 18:34
3 tears_of_hate Nov 21, 2007 02:56
Hey,
thanks but it doesn't work.
Here is my code:
$searcher = '/<img(.*?)src="' . (addcslashes($match, './')) . '"(.*?)(width="([0-9]*)")*(.*?)(height="([0-9]*)")*(.*?)>/';
$replacer = '<img${1}src="' . $thumbfile . '"${2}${5}${8}>';
This works, but only if no height/width is given and if width is before height.
$searcher = '/<img(.*?)src="' . (addcslashes($match, './')) . '"(.*?)(width="([0-9]*)")(.*?)(height="([0-9]*)")(.*?)>/';
$replacer = '<img${1}src="' . $thumbfile . '"${2}${5}${8}>';
This works to, but only if height/width is given and if width is before height.
The difference between this to codes is the * behind the height/width-areas. If someone can make this work in every way it would be very, very nice. Also it would be nice if height and width doesn't need to be next to each other...
4 tears_of_hate Nov 21, 2007 20:33
Ok, got it :)
Try this:
It's untested, but the idea is: find IMG tags and therein replace any width/height attribs with nothing.