How to extract image img from a string variable?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.