error_reporting(E_ALL);
ini_set('display_errors','On');
//include __DIR__ . DIRECTORY_SEPARATOR . 'files/File/ImagickMgr.inc.php';
include __DIR__ . DIRECTORY_SEPARATOR . 'wp-config.php';
$image_url = $_GET['url'];
//$post_id = url_to_postid($image_url);
$i = '2139';
$count = 1;
for ($i=2139; $i < 9000; $i++) {
$content_post = get_post($i);
$type = $content_post->post_type;
if($type == 'post'){
echo $count++;
echo ' : ';
echo $image_url = ''.$content_post->post_title.'';
// $wpblog_fetrdimg = wp_get_attachment_url( get_post_thumbnail_id($i) );
//echo "";
echo "
";
echo "
";
}
}
exit();
foreach ($slug as $image_url) {
print_r($image_url);
$post_id = url_to_postid($image_url);
$wpblog_fetrdimg = wp_get_attachment_url( get_post_thumbnail_id($post_id) );
$frames=[];
if( $wpblog_fetrdimg ) : $frames[]= str_replace('http://igreen.pk/pakpedia/', '/home/igreen/public_html/pakpedia/',$wpblog_fetrdimg); endif;
$my_postid = $post_id;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
// echo $image_url = $content_post->post_name;
// echo "
";
// echo "
";
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
//echo $content;
$dom = new DOMDocument();
$dom->loadHTML($content);
$images = $dom->getElementsByTagName('img');
$count=0;
foreach ($images as $image) {
if($count<4){
$frames[] = str_replace('https://www.pakpedia.pk/', '/home/igreen/public_html/pakpedia/', $image->getAttribute('src') );
}
$count++;
}
if(count($frames) >= 5){
\File\ImagickMgr::albumCard5($frames)->watermarkText('https://www.pakpedia.pk/'.$image_url)->compress()->save('/home/igreen/public_html/pakpedia/files/Image/og/'.$image_url.'.jpg');
}
echo $image_url.'.jpg';
}