How to extract image img from a string variable ??.... $ Str = '& lt; p & gt; previous product diagram & lt;/p & gt; & lt; img & nbsp; src = "2012/1015/13502676392767.jpg" & nbsp; align =" middle "& nbsp; alt =" "& how to extract image img from a string variable ??....
$ Str ='
Go to the previous product diagram
The bottle has a big brand logo.
Material in a dense texture
It can be seen from a hand trial that the effect is really good!
I want to display the image separately, the text separately, and the text strip_tags ($ str);. but how can I extract the image for display ??
------ Solution --------------------
Use regular expressions
Preg_match_all ('/] +>/is', $ s, $ m );
Print_r ($ m );
------ Solution --------------------
Do you mean to control the display width or generate a thumbnail?
------ Solution --------------------
This function needs to be implemented using js. Steps:
1. read the image first
2. get the width and height of the image from the dom.
3. set the new width and height after calculation to the dom.