Quote:
Originally Posted by shinmusashi44
I was wondering how to do these:
1: How to script a gallery scraper so that CyberSEO can scrape galleries from a standard RSS Feed.
|
1) Syndicate the FHG RSS feed (e.g.
http://nats.ddfcash.com/ddfrss_22_1_...17_100_c_p.rss);
2) Put the following code into the "PHP code <?php .. ?>" box:
PHP Code:
if (!cseo_post_exists($post)) {
$max_images = 20;
$thumb_width = 180;
$thumb_height = 240;
$link = "http://www.google.com/";
add_image_size('thumbnail', $thumb_width, $thumb_height, true);
$gallery = cseo_file_get_contents($post['link']);
global $cseo_last_effective_url;
if (isset($cseo_last_effective_url)) {
$base_url = $cseo_last_effective_url;
} else {
$base_url = $post['link'];
}
preg_match_all('/<a.+?href=[\s]?["|\']([\w%-\.\/:\?&=]+\.(jpg|jpeg|png|gif))["|\'].*?>.*?<img.*?src.*?>/is', html_entity_decode($gallery), $matches);
for ($i = 0; $i < min(((int) (count($matches[1]) / 4)) * 4, $max_images); $i++) {
if (stripos($matches[1][$i], "http://") !== false) {
$image = $matches[1][$i];
} elseif (substr($matches[1][$i], 0, 1) == "/") {
$image = "http://" . parse_url($base_url, PHP_URL_HOST) . $matches[1][$i];
} else {
$image = str_replace(basename($base_url), "", $base_url) . $matches[1][$i];
}
cseo_add_image_to_library($image, $post['post_title']);
}
$post['post_excerpt'] = strip_tags($post['post_excerpt']) . '<p>[gallery columns="4"]</p>';
$post['post_excerpt'] .= "<h2 align=\"center\"><a href=\"" . $link . "\" target=\"_blank\">Click Here For More!</a></h2>\n";
} else {
$post = false;
}
Make sure to setup the following variables:
$max_images – max images to be added into the gallery;
$thumb_width – thumbnail width;
$thumb_height – thumbnail height ;
$link – your affiliate link to a paysite.
3) Select "Generate from the first post image" in the "Post thumbnail" drop-down box.
4) Save the settings.
Quote:
Originally Posted by shinmusashi44
2: How to remove the image from the RSS Feed, since said image is being used and stored locally as a featured image.
|
Simple do not store it locally (disable the appropriate option).