Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
API:EPrints/Plugin/Convert/Thumbnails
(section)
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==METHODS== <!-- Pod2Wiki=head_can_convert --> ===can_convert=== <source lang="perl">%types = $plugin->can_convert( $doc ) </source> Returns a hash map of types this plugin can convert $doc to. This may be relatively expensive to do if the plugin has to call an external tool to determine if it can export something. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_convert --> ===convert=== <source lang="perl">$new_doc = $plugin->convert( $eprint, $doc, $type ) </source> Request the plugin converts $doc to $type, as returned by [[API:EPrints/Plugin/Convert/Thumbnails#can_convert|can_convert]]. <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_export --> ===export=== <source lang="perl">@filelist = $plugin->export( $dir, $doc, $type ) </source> Request the plugin converts $doc to $type, as returned by [[API:EPrints/Plugin/Convert/Thumbnails#can_convert|can_convert]]. Outputs the resulting files to $dir and returns their paths (excluding the leading $dir part). <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_utility_methods --> ===Utility Methods=== $ver = $plugin->convert_version() Returns the MAJOR.MINOR version of ImageMagick. Returns 0.0 if the version can not be determined. $ok = $plugin->is_video( $doc ) Returns true if $doc is a video. $doc = $plugin->intermediate( $doc, $src, $geom, $src ) Attempt to find an intermediate document that we can use to convert from (e.g. make a thumbnail from a preview version). Returns the original $doc if not intermediate is found. $plugin->call_convert( $dst, $doc, $src, $geom, $size ) Calls the ImageMagick <em>convert</em> tool to convert $doc into a thumbnail image. Writes the image to $dst. $src is the full path to the main file from $doc. The resulting image should not exceed $geom dimensions ([w,h] array ref). $size is the thumbnail-defined size (as-in the keys to the '''sizes''' parameter). This method can be overridden with the '''call_convert''' parameter. $plugin->call_ffmpeg( $dst, $doc, $src, $geom, $size, $offset ) Uses the <em>ffmpeg</em> tool to do the image conversion of $doc. $dst is the filename to write to, $src is the filename to read from and $geom is the image dimensions to write. $size is the thumbnail-defined size (as-in the keys to the '''sizes''' parameter or '''audio''' or '''video'''). $offset is the time offset to extract (for '''audio'''/'''video'''). It is an array ref of [HOUR, MINUTE, SECOND, FRAME]. $plugin->export_mp3( $dst, $doc, $src, $rate ) Export $src to $dst in MP3 format at sampling rate $rate. $plugin->export_audio( $dst, $doc, $src, $container ) Export audio-only $src to $dst in $container format. Audio is encoded as <em>audio_codec</em>. $plugin->export_video( $dst, $doc, $src, $container ) Export audio and video $src to $dst in $container format with vertical lines $lines maintaining aspect ratio. Video is encoded as <em>video_codec</em>. Audio is encoded as <em>audio_codec</em>. $plugin->export_cell( $dir, $doc, $src, $geom, $size, $offset ) Export $src to $dst in JPG format in dimensions $geom from offset $offset. $secs = $plugin->calculate_offset( $duration, $offset ) Translates a seconds or percentage offset into seconds from the start time. If the resulting time is greater than $duration returns $duration. To specify seconds either use just a number (1234) or append 's' (1234s). To specify a percentage of $duration append '%' (52%). <!-- Edit below this comment --> <!-- Pod2Wiki= --> <!-- Pod2Wiki=head_see_also -->
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)