Version: 0.1.0
Contributors: George Mamadashvili, Jay Wood
Description: Class to grab images from the body of a website.
Author: WebDevStudios
Author URI: http://webdevstudios.com/
Requires at least: 3.6.0
Tested up to: 4.2.2
Stable tag: 0.1.0
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
A PHP class to get a list of image URLs from a remote address and return them in an array. Works in conjunction with CMB2 Remote Image Select Field to provide users a facebook-style image selector for post-meta data.
The script looks for og:image
tags first, then looks for all <img>
tags within the content of the entire site. Additionally it now provides a few extra checks to ensure
that the image should in-fact be pulled into the list, the rules are as follows:
- If the image has no height/width element, it will not be pulled
- If height or width are less than 70px, it will not be pulled
- If image is relative such as
src="/relative/path.jpg"
it will not be pulled
This can be changed, or expanded upon by editing the WDS_Image_Grabber::img_tags()
method.
$url = 'http://www.amazon.com//Sales-Grocery/b?ie=UTF8&node=52129011&ref_=amb_link_353229922_2';
$grabber = new WDS_Image_Grabber( $url );
$images = $grabber->get_images();
var_dump( $images );
- Upload the entire
/wds-image-grabber
directory to the/wp-content/plugins/
directory. - Activate CMB2 Remote Image Select through the 'Plugins' menu in WordPress.
- None as of yet
- First release