Announcement

#1 2016-01-04 21:03:04

Olaf Buitelaar
Guest

issue when uploading video

Hi,

first of all thanks for the nice work!

I found an issue if an video file is uploaded.
It appears in the file functions_upload.inc.php @function add_uploaded_file, the thumbnail is created correctly, however when the file is actually inserted into the database it calls: pwg_image_infos to resolve the image dimensions, in here the video path is passed instead of the thumbnail path.
i've resovled this internally to add an addition check in the pwg_image_infos function, to catch the thumbnail path instead;

function pwg_image_infos($path)
{
    $original_extension = strtolower(get_extension($path));
    $ffmpeg_video_exts = array( // extensions tested with FFmpeg
    'wmv','mov','mkv','mp4','mpg','flv','asf','xvid','divx','mpeg',
    'avi','rm',
    );
  if (in_array($original_extension, $ffmpeg_video_exts)){
      $orig_path = $path;   
      $path = dirname($path).'/pwg_representative/'.get_filename_wo_extension(basename($path)).'.jpg';
  }
  list($width, $height) = getimagesize($path);
  $filesize = floor(filesize($path)/1024);

  return array(
    'width'  => $width,
    'height' => $height,
    'filesize' => $filesize,
    );
}

it isn't the cleanest solution, but it works for me.
maybe it will also help somebody else

Cheers Olaf

Piwigo version: 2.7.4
PHP version: 5.6
MySQL version: 5.6

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact