Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Trying to implement Auto Thumb Creation with VirusScan before per my other site  (Read 5091 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Posts: 11

Why can't coppermine create thumbnails for my videos?

All this custom thumbnail business might appear very complicated to newbies, and in fact you're right: this is a complicated process. Therefore, many users ask why this has to be so complicated. Coppermine can create thumbnails for images, so why can't it create thumbnails for videos? The reason is pretty simple: because the image libraries that Coppermine is relying on (GD or ImageMagick, see "Minimum requirements") to create thumbnails from images don't support videos. It's not that the Coppermine developers have been reluctant to come up with code that auto-creates thumbnails for videos - it's just that they can't because the technology that is available on your webserver can't.

I understand the above statement from the help files however, i know HOW script wise to do this.  The technology IS there you just need to unleash it.  FFMPEG is usually available now on MOST servers.  And it doesn't take any resources to do this either as its executed OUTSIDE the application. Your already making Exec calls in your code so you can make these calls also. I just need someone to point me in the appropriate area whether its in a theme or if there is a way to add an include with my code to cause after a video has been uploaded to scan it and make a video thumbnail.  In my previous site, I had modified its FTP to HTML5 forms so I didn't have to share/create ftp accounts.  I had then coded AUTO clamAV scan and then to use FFMPEG to make me a thumbfile.  Scanning of viruses went through a very rouge file checker sniffing for scripts, executable s in the file even before it went through the scanner.  Worked nicely to catch anything.

 The old album needed to make a file with .videoExt.png to display videos properly and didnt exist.  Like  yours, just seems to require thumbs_ and jpg which could be done.  Below is the code sequence from my old system which was called at the end of the upload sequence using the forms $_File value.  Before any of this, AntivirusScan() had to return true.  This code is not posted in its entirety as its still used by some family members on the old site as i get this one up and running.

My old upload sequence which i'm trying to identify to manipulate in your code:

if ($uploadOk == 0 || $sniffOK== 0) {
  echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
  if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    //  Create a thum for this file so the program sees it if not a virus.
     if ($probe=='File: OK'){
       echo "<br/>The file ".$target_name. " has been uploaded to the selected folder.<br/>";} else {echo "<br/> Your file ".$target_name." has been quarantined and has been deleted by ClamAV from our server!!";}

My Antivirus Function, Returns true if all good.

function AntivirusScan() {
   //Final checks - Antivirus Scan trigger.  Purge bad downloads
   Global $target_file;
   $virusscaner='"C:\Program Files\ClamAV\clamdscan.exe"';
   if(strlen($target_file)< 13) {Exit("ClamAV:Scanner Failure. invalid Filename.");}
   if (substr_count ($scan_file,".")>2){exit ("EasyCheck Error: Corrupt Target File Definition. Escape!");}
   $scan_file=' "'.$scan_file.'"';
   //print $virusscaner.$scan_file;
   $fileOK=$scanerint[0]; // this int changes with versions...whatch it!
   echo "<br/>Requesting Virus Scan.  Please Wait";
   echo "<br/>Antivirus: ClamAV 0.102.3/26008<br/><br/>";
   //print $scanerint; seems to change ???
   // 0=Status Messages
   // 1=File OK FAIL with fullpath
   // 2=empty
   // 3-11 are summary

   //Remove top 2

   if (strpos($fileOK,"OK")){$ScanSuccess="File: OK";} else {
      $ScanSuccess="Virus Found!";
   echo '<br/>----------- SCAN COMPLETE -----------<br/>';
   Return $ScanSuccess;

The function that makes a thumbfile:

function MakeThumb($file){

// Thumb file at 5 sec mark
$video = '"'.$file.'"';
$thumbnail = '"'.$file.'.png'.'"';
$command=' -i '.$video.' -deinterlace -an -ss 5 -t 00:00:05 -r 1 -y -vcodec mjpeg -f mjpeg '.$thumbnail.' 2>&1';
//print $ffmpeg.$command;

print '<br/>';
echo '<br/>------ Thumb Creation for Video ------<br/>';
print '<br/>'.$abc.'<br/>';

I realize i prob wont be able to output anything which is fine, i would just need to know how to also interrupt the process if my scanner call sees something nasty. 



  • Coppermine newbie
  • Offline Offline
  • Posts: 11

Edit:  Sorry the Scanner doesn't return a bol but could.  It returns text for output reasons in the old site.


  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026

I think thumbnails for videos are better when you can choose a specific frame in the video.
Take a look at this method.


  • Coppermine newbie
  • Offline Offline
  • Posts: 11

I think thumbnails for videos are better when you can choose a specific frame in the video.
Take a look at this method.

You need a like button for replies.  Ill check this out.  Sweet!  Some reason didn't see it when i was searching.  Thanks ron4mac
Pages: [1]   Go Up

Page created in 0.022 seconds with 20 queries.