MantisBT - Piwigo
View Issue Details
0003208Piwigouploadpublic2015.03.02 15:112015.03.03 15:41
Apache 1.3.x
0003208: getimagesize() on php on windows returns no width and height for mp4 files
From [^]

In /admin/include/ 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
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/
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).
    /* 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,
No tags attached.
Issue History
2015.03.02 15:11xbgmsharpNew Issue
2015.03.02 15:11xbgmsharpbrowser => any
2015.03.02 15:11xbgmsharpWeb server => Apache 1.3.x
2015.03.03 15:41xbgmsharpNote Added: 0007776

2015.03.03 15:41   
I think i find a work around. [^]

When confirm we could close this ticket.
However it is interesting to keep in mind as it is a windows specific issue.