Module z_media_preview

Make still previews of media, using image manipulation functions.

Copyright 2009-2014 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Make still previews of media, using image manipulation functions. Resize, crop, gray, etc. This uses the command line imagemagick tools for all image manipulation. This code is adapted from PHP GD2 code, so the resize/crop could've been done more efficiently, but it works :-)

Function Index

calc_size/7Calculate the size of the resulting image, depends on the crop and the original image size.
can_generate_preview/1Check if we can generate a preview image of the given mime type.
cmd_args/3Map filters to commandline options.
convert/4Convert the Infile to an outfile with a still image using the filters.
convert/5
out_mime/2Return the preferred mime type of the image generated by resizing an image of a certain type and size.
out_mime/3Determine the output mime type, after expanding optional mediaclass arguments.
size/3Calculate the size of the resulting image.
string2filter/2Map the list of known filters and known args to atoms.

Function Details

calc_size/7

calc_size(Width, Height, ImageWidth, ImageHeight, CropPar, Orientation, IsUpscale) -> any()

Calculate the size of the resulting image, depends on the crop and the original image size

can_generate_preview/1

can_generate_preview(B::Mime) -> true | false

Check if we can generate a preview image of the given mime type

cmd_args/3

cmd_args(FileProps, Filters, OutMime) -> any()

Map filters to commandline options

convert/4

convert(InFile, OutFile, Filters, Context) -> ok | {error, Reason}

Convert the Infile to an outfile with a still image using the filters.

convert/5

convert(InFile, MediumFilename, OutFile, Filters, Context) -> any()

out_mime/2

out_mime(Mime, Options) -> {Mime, Extension}

Return the preferred mime type of the image generated by resizing an image of a certain type and size.

out_mime/3

out_mime(Mime, Options, Context) -> any()

Determine the output mime type, after expanding optional mediaclass arguments.

size/3

size(Props::MediaRef, Filters, Context) -> {size, Width, Height, ResizedMime} | {error, Reason}

Calculate the size of the resulting image.

string2filter/2

string2filter(X1::Filter, Where::Arg) -> FilterTuple

Map the list of known filters and known args to atoms. Used when mapping preview urls back to filter args.


Generated by EDoc, Jul 29 2014, 17:16:24.