• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] How to add default thumbnails to videos with unavailable thumbnails.

Started by gaunt93,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gaunt93Topic starter

I play most of my videos remotely, and sometimes a see a broken link for the thumbnail image. I was wondering if there was a way to add a default image to fill that space. Thanks!
  •  

PHPVibe A.


gaunt93Topic starter

Awesome thanks for the idea. It was .video-thumb, but now I need to get rid of the broken link the webpage is trying to load.
  •  

PHPVibe A.

Here is an function to use somewhere:

function checkRemoteFile($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    // don't download content
    curl_setopt($ch, CURLOPT_NOBODY, 1);
    curl_setopt($ch, CURLOPT_FAILONERROR, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if(curl_exec($ch)!==FALSE)
    {
        return true;
    }
    else
    {
        return false;
    }
}


It will return false if the file no longer exists, and you can use an unpublish for it.
Not delete, as you may want to manually check it to.

gaunt93Topic starter

Awesome. I'll look into using it. But this is what I did to replace a broken img link.


tpl\main\video-loop.php:
<div id="video-'.$video->id.'" class="video">
<div class="video-thumb">
<a class="clip-link" data-id="'.$video->id.'" title="'.$full_title.'" href="'.$url.'">
<span class="clip">
<img src="'.thumb_fix($video->thumb, true, get_option('thumb-width'), get_option('thumb-height')).'" alt="'.$full_title.'"/><span class="vertical-align"></span>
</span>
          <span class="overlay"></span>
</a>';


to this
<div id="video-'.$video->id.'" class="video">
<div class="video-thumb">
<a class="clip-link" data-id="'.$video->id.'" title="'.$full_title.'" href="'.$url.'">
<span class="clip">
<img src="'.thumb_fix($video->thumb, true, get_option('thumb-width'), get_option('thumb-height')).'" alt="'.$full_title.'" onerror="this.src=\'../../uploads/favicon300x300.png\'; this.id=\'img_thumb\'"/><span class="vertical-align"></span>
</span>
          <span class="overlay"></span>
</a>';


I will look into using the code you gave me, and ill post back here if i come up with something.
  •  

PHPVibe A.

Hey, don't use it in a loop (the check function for remote), mainly in com_com_video.php I would use it, to check it on access, cause on loop it's overkill.

 

Similar topics (7)

Important Announcement: PHPVibe Video Sharing CMS End of Life

Started by Marius P.


Replies: 1
Views: 44794

insite ads issue when selecting above/below video player location

Started by georgepanaitescu


Replies: 3
Views: 25483

The problem of video viewing PHPVibe 5.0

Started by Nayn


Replies: 25
Views: 73420

embed video does not work on v5

Started by neospider69


Replies: 6
Views: 54876

when slecting to unpublish music mp3 - next page says unpublished video ?

Started by spirog


Replies: 2
Views: 4848

video,playlist,images, etc. (frontend) select all deselect all reselect all

Started by spirog


Replies: 3
Views: 8334

Like a video - unlinke a video - relike a video does not work

Started by spirog


Replies: 7
Views: 6975