In /admin/include/functions_upload.inc.php I have changed the function pwg_image_infos($path).
This is necessary because getimagesize() on php on windows no width and height for mp4 files returns.
getimagesize() on php on windows heigth and width are empty (not 0, but empty) on Windows
Steps to reproduce: For video upload I use the web form in the admin menu (Photos - Add), with a small video named test_9mb.mp4.
Just before the upload of the video is done the function
add_uploaded_file("./upload/buffer\test_9mb.mp4", "test_9mb.mp4", .....
is called (in /admin/include/functions_upload.inc.php).
This function calls $file_infos = pwg_image_infos("././upload/2015/02/28/20150228204355-3b12953d.mp4");
In this function is getimagesize with the mp4 video used, that does not work (see my changes in this function, I use ffmepg).
Additional information: /* function changed by photonensammler because getimagesize() on windows returns no width and height für video files /
/ ffmpeg must be installed !!! */
**Reported by xbgmsharp on 2 Mar 2015 14:11**
**Version:** 2.7.4
From https://github.com/xbgmsharp/piwigo-videojs/issues/45
In /admin/include/functions_upload.inc.php I have changed the function pwg_image_infos($path).
This is necessary because getimagesize() on php on windows no width and height for mp4 files returns.
getimagesize() on php on windows heigth and width are empty (not 0, but empty) on Windows
**Steps to reproduce:** For video upload I use the web form in the admin menu (Photos - Add), with a small video named test_9mb.mp4.
Just before the upload of the video is done the function
add_uploaded_file("./upload/buffer\test_9mb.mp4", "test_9mb.mp4", .....
is called (in /admin/include/functions_upload.inc.php).
This function calls $file_infos = pwg_image_infos("././upload/2015/02/28/20150228204355-3b12953d.mp4");
In this function is getimagesize with the mp4 video used, that does not work (see my changes in this function, I use ffmepg).
**Additional information:** /\* function changed by photonensammler because getimagesize() on windows returns no width and height für video files _/
/_ ffmpeg must be installed !!! */
```
function pwg_image_infos($path) {
global $conf;
$size = getimagesize($path);
if (($size === FALSE || $size == 0) && isset($conf['vjs_sync'])) { //use ffmepg to get the size
$ffmpeg = unserialize($conf['vjs_sync']);
$ffmpeg_return = shell_exec($ffmpeg['ffmpeg'] . ' -i "' . $path . '" -vstats 2>&1');
$regex_sizes = "/([0-9]{1,4})x([0-9]{1,4})/";
preg_match($regex_sizes, $ffmpeg_return, $regs);
$size = explode('x', $regs[0]);
}
list($width, $height) = $size;
$filesize = floor(filesize($path) / 1024);
return array(
'width' => $width,
'height' => $height,
'filesize' => $filesize,
);
}
```
[Piwigo Bugtracker #3208](http://piwigo.org/bugs/view.php?id=3208)
<!-- github-sync-id:97227085 -->
When confirm we could close this ticket.
However it is interesting to keep in mind as it is a windows specific issue.
**Comment posted by xbgmsharp on 3 Mar 2015 14:41**
I think i find a work around.
https://github.com/xbgmsharp/piwigo-videojs/commit/8396f719d105c440b260d09725a830cd65a7c1be
When confirm we could close this ticket.
However it is interesting to keep in mind as it is a windows specific issue.
<!-- github-comment-id:124899226 -->
I still have problem with getimagesize() returning empty width and height for mp4 on Windows (https://github.com/xbgmsharp/piwigo-videojs/issues/45). I don't understand how this works for others as looking at php getimagesize function (http://php.net/manual/en/function.getimagesize.php) it is only meant for image file and not video file?
<!-- github-comment-id:140346415 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Reported by xbgmsharp on 2 Mar 2015 14:11
Version: 2.7.4
From https://github.com/xbgmsharp/piwigo-videojs/issues/45
In /admin/include/functions_upload.inc.php I have changed the function pwg_image_infos($path).
This is necessary because getimagesize() on php on windows no width and height for mp4 files returns.
getimagesize() on php on windows heigth and width are empty (not 0, but empty) on Windows
Steps to reproduce: For video upload I use the web form in the admin menu (Photos - Add), with a small video named test_9mb.mp4.
Just before the upload of the video is done the function
add_uploaded_file("./upload/buffer\test_9mb.mp4", "test_9mb.mp4", .....
is called (in /admin/include/functions_upload.inc.php).
This function calls $file_infos = pwg_image_infos("././upload/2015/02/28/20150228204355-3b12953d.mp4");
In this function is getimagesize with the mp4 video used, that does not work (see my changes in this function, I use ffmepg).
Additional information: /* function changed by photonensammler because getimagesize() on windows returns no width and height für video files /
/ ffmpeg must be installed !!! */
Piwigo Bugtracker #3208
Comment posted by xbgmsharp on 3 Mar 2015 14:41
I think i find a work around.
https://github.com/xbgmsharp/piwigo-videojs/commit/8396f719d105c440b260d09725a830cd65a7c1be
When confirm we could close this ticket.
However it is interesting to keep in mind as it is a windows specific issue.
I still have problem with getimagesize() returning empty width and height for mp4 on Windows (https://github.com/xbgmsharp/piwigo-videojs/issues/45). I don't understand how this works for others as looking at php getimagesize function (http://php.net/manual/en/function.getimagesize.php) it is only meant for image file and not video file?