Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • Saguaros Moderator
    #1013259

    Hi,

    Could you share the URL and admin login info of your site? and tell me the FB profile you’re mentioning.

    I will take a look.

    Regards

    coliberek Friend
    #1013335
    This reply has been marked as private.
    Mo0nlight Moderator
    #1013834

    Hi,

    You can try open the file : plugins/system/jasocial_feed/jasocial_feed.php

    change the line :

    $dt->img = str_replace(array('&cfs=1', 'maxresdefault'), array('', '0'), urldecode($mat[1]));

    To:

    $dt->img = preg_replace('/\&cfs\=1(.*?)$/','',urldecode($mat[1]));
    coliberek Friend
    #1014166

    Hello,

    thank you very much. Now it downloaded the image of YT video instead this default one.
    But I would like to display also video from YY on my website in the imported post.

    Mo0nlight Moderator
    #1014599

    Hi,

    You can try this way:

    • Open the file : ROOT/plugins/system/jasocial_feed/jasocial_feed.php

    • Change the code:
    if($getImg) {
                        $img_caption = $this->getImageCaption($tcontent);
                        if (preg_match('/i.ytimg.com/', $dt->img)) { // img from youtube
                            preg_match('/url=(.*?)$/', $dt->img, $mat);
                            if (!empty($mat[1])) {
                                $dt->img = preg_replace('/\&cfs\=1(.*?)$/','',urldecode($mat[1]));
                            }
                        }
                        $post['source_images'] = $this->getFacebookImage('<img src="'.$dt->img.'" />',$img_caption, $img_caption);
    //                   if (empty($post['source_images']) && !empty($dt->img)) {
    //                      $post['source_images'] = $this->saveImage($dt->img, 'facebook', $img_caption, $img_caption);
    //                   }
                        // remove direct image in facebook content
    //                   $tcontent = preg_replace ('/<img [^>]+>/', '', $tcontent);
                    } else {
                        $post['source_images'] = false;
                    }
    
                    // add new intro text progress.
                    $post['source_content'] = $tcontent;

    To

    $youtubeembed = '';
                    if($getImg) {
                        $img_caption = $this->getImageCaption($tcontent);
                        if (preg_match('/i.ytimg.com/', $dt->img)) { // img from youtube
                            preg_match('/url=(.*?)$/', $dt->img, $mat);
                            if (!empty($mat[1])) {
                                $dt->img = preg_replace('/\&cfs\=1(.*?)$/','',urldecode($mat[1]));
                                $youtubeid = preg_replace('/^(.*?)vi\/(.*?)\/(.*?)\.jpg$/','$2',$dt->img);
                                $youtubeembed = '<p><iframe width="560" height="315" src="https://www.youtube.com/embed/'.$youtubeid.'" frameborder="0" allowfullscreen></iframe></p>';
                            }
                        }
    
                        $post['source_images'] = $this->getFacebookImage('<img src="'.$dt->img.'" />',$img_caption, $img_caption);
    //                   if (empty($post['source_images']) && !empty($dt->img)) {
    //                      $post['source_images'] = $this->saveImage($dt->img, 'facebook', $img_caption, $img_caption);
    //                   }
                        // remove direct image in facebook content
    //                   $tcontent = preg_replace ('/<img [^>]+>/', '', $tcontent);
                    } else {
                        $post['source_images'] = false;
                    }
    
                    // add new intro text progress.
                    $post['source_content'] = $tcontent.$youtubeembed;

    Around line : 414 -> 433

    coliberek Friend
    #1016026

    Great Thank you very much for the magic. Now it is working great 🙂

Viewing 6 posts - 1 through 6 (of 6 total)

This topic contains 6 replies, has 3 voices, and was last updated by  coliberek 7 years, 2 months ago.

The topic ‘video in posts imported from fb’ is closed to new replies.