Answer the question
In order to leave comments, you need to log in
How to set a regular expression to find src only for img?
Beaver everyone.
I have been suffering for 3 days already, there is CKEditor, in which I load images via base64image, everything suits me, but I need to store the path to 1 image in the database. (i.e. there can be 20 of them, but we take 1 img and save its src to the database).
'/src="([^"]+)/' I did this, everything suits, but this is finding src for all tags, not just for img
Help comrades, thanks in advance!
Answer the question
In order to leave comments, you need to log in
symfony.com/doc/current/components/dom_crawler.html
$dom = new Crawler($html);
$images = $dom->filterXPath('//img')->extract(array('src')); // extract images
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question