I am using ffmpeg to generate thumbnails for the videos. Currently, I have a shell script which checks all the video files in a given directory, and creates a similarly named jpg image for the thumbnail. And, of course, I run this manually to get the job done. I'd like to automate the task to be done at the same time normal image thumbnails are generated, but I can't figure out where that is done in the code. I'm a C/C++ guy, so I have the general chops, but lack the familiarity with PHP/JS/etc. Thanks for any help.
Comments
Actually Zenphoto will create those images when needed itself if needed. Some info about caching:
http://www.zenphoto.org/news/caching/
Actually I would not recommend to hook into class-video as that will not be future save. Instead I suggest you create a plugin that hooks into the `new_image` filter which triggers on discovery of a new "image" from the file system. Extract the image there, the image processor then will work with the created sidecar image as with all else. Take a look here:
http://www.zenphoto.org/news/zenphoto-plugin-architecture/#zenphoto-filters
1) above: There is `isImagePhoto()`and `isImageVideo()` to check if the image is an actual image and not any "non image" image like video, audio or whatever.
2) Theoretically you can send a pull request and we appreciate the thought. But for now I would prefer a separate plugin. One reason is I cannot even test your change as I don't have any server with ffmpeg available and don't manage my own. ZP is for standard hosting primarily so most people won't have it available.
Also behind the scenes we are aworking on an major version (no not in public in case you wanted to ask, sorry) and that restructures a few things internally and that involves the video-class, too. So in 1.4.x we will not make such probably significant changes anymore unless it would be a bug (which this is sureyl not).
To the other question: Cached images will be re-created on size changes etc. as long as the image to create from still exists. Can't your plugin just delete the existing sidecar image if it is decided to use something else? If it also clears the cache on that occasion it should be regenerated as normal.
Regarding my concern about edge cases, yes, I could have my plugin delete all of the sidecar images if a parameter is changed, but this feels very brute force. As well, that doesn't handle the other edge case of the sidecar file being deleted behind the scenes. Which I suppose I could handle by putting an option in the plugin to iterate over the entire gallery and create any missing sidecar images. But, doing it at thumbnail request time is the perfect solution, just as it is for maintaining the thumbnail cache.
Based on this discussion, I am going to keep my hacked version of class-video, since this is working exactly as I want it. And if the new version of ZP offers a more elegant solution, then I will proceed with a proper plugin.
Also, if you are interested, here is my background: http://www.musetrap.com/cpr/resume
Okay, best keep your modified version or even provide it as a plugin for others to use for the time being. The filters will remain even if some other internal stuff changes.
Thanks for your background ;-) Please be assured we welcome any kind of contribution and plugins for specific tasks are as well.