The php extension ffmpeg configuration is successful and the image is automatically output.
$ FN = "C:/inetpub/wwwroot/"; if (extension_loaded ('ffmpeg ') {// judge whether ffmpeg is loaded $ mov = new ffmpeg_movie ($ fN. "44.mp4"); // Video path $ count = $ mov-> getFrameCount (); $ ff_frame = $ mov-> getFrame (80 ); // capture an 80-frame image if ($ ff_frame) {$ gd_image = $ ff_frame-> toGDImage (); $ img = "/test.jpg "; // The absolute path header ('content-Type: image/jpeg ') of the image to be generated; imagejpeg ($ gd_image); // Create a jpg image, you can display // imagejpeg ($ gd_image, $ fN. $ img); // Create a jpg image. The image imagedestroy ($ gd_image) cannot be output; // destroy an image} else {echo "ffmpeg not loaded ";}
In php5.4, ffmpeg is successfully configured. the code above indicates that the video is a local video source and imagejpeg ($ gd_image) is called ); this can display a screenshot in the browser of the Test environment built on the local machine. However, if you call imagejpeg ($ gd_image, $ fN. $ img), the image in the output local path cannot be generated. Please check if any code is missing?
Reply to discussion (solution)
Imagejpeg ($ gd_image); yes
Imagejpeg ($ gd_image, $ fN. $ img );
Check whether the permission is sufficient.
$ FN = "C:/inetpub/wwwroot /";
Are you using IIS?
By default, directories managed by IIS do not have the write permission. you need to set the permission in the manager.
Imagejpeg ($ gd_image); yes
Imagejpeg ($ gd_image, $ fN. $ img );
Check whether the permission is sufficient.
$ FN = "C:/inetpub/wwwroot /";
Are you using IIS?
By default, directories managed by IIS do not have the write permission. you need to set the permission in the manager.
Well, I am using IIS. Thanks. thank you!