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);
$wpblog_fetrdimg = wp_get_attachment_url( get_post_thumbnail_id($post_id) );
if( $wpblog_fetrdimg ) : $frames[]= str_replace('https://www.pakpedia.pk/', '/home/igreen/public_html/pakpedia/',$wpblog_fetrdimg); endif;
$thumb = get_the_post_thumbnail_url($post_id);
$frames=[];
$frames[]= str_replace('https://www.pakpedia.pk/', '/home/pakpedia/public_html/', $thumb);
$my_postid = $post_id;//This is page id or post id
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$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<5){
$frames[] = str_replace('https://www.pakpedia.pk/', '/home/pakpedia/public_html/', $image->getAttribute('src') );
}
$count++;
}
//$frames = array('/home/pakpedia/public_html/files/Image/jpg/fd58e5f78d805f1bfc6849ed97acc3c9.jpg','/home/pakpedia/public_html/files/Image/jpg/721cc1aceda6130fdd6cd4eba95ccc96.jpg','/home/pakpedia/public_html/files/Image/jpg/e16cc8db9bf65ab27991cb59d8a90990.jpg','/home/pakpedia/public_html/files/Image/jpg/5ed8f8b3e989b735f28010f002a56436.jpg','/home/pakpedia/public_html/files/Image/jpg/d4f4a5302eeb8c383786867e9639f13e.jpg' );
//print_r($frames);
//exit();
\File\ImagickMgr::albumCard5($frames)->watermarkText('https://www.pakpedia.pk/'.$image_url)->compress()->save('/home/pakpedia/public_html/files/Image/og/'.$image_url.'.jpg');
echo '';
echo "
";
echo 'https://pakpedia.pk/files/Image/og/'.$image_url.'.jpg';