Documentation

Metafile
in package

Helper for Windows Metafiles (WMF, EMF and EMF+), based on phpoffice/wmf.

Table of Contents

Constants

MIMETYPE_EMF  = 'image/x-emf'
MIMETYPE_WMF  = 'image/x-wmf'
TYPE_EMF  = \PhpOffice\WMF\Reader\Detector::TYPE_EMF
TYPE_EMFPLUS  = \PhpOffice\WMF\Reader\Detector::TYPE_EMFPLUS
TYPE_WMF  = \PhpOffice\WMF\Reader\Detector::TYPE_WMF

Methods

detect()  : string|null
Get the metafile type (TYPE_WMF, TYPE_EMF or TYPE_EMFPLUS) of some content, or null if it is not a metafile.
detectFile()  : string|null
Get the metafile type (TYPE_WMF, TYPE_EMF or TYPE_EMFPLUS) of a file, or null if it is not a metafile.
getExtension()  : string
Get the file extension for a metafile type ("wmf" or "emf").
getMimeType()  : string
Get the mime type for a metafile type.
toGdImage()  : GdImage
Render a metafile as a GD image.
toPng()  : string
Render a metafile as PNG data.
tryToGdImage()  : GdImage|null
Render a metafile as a GD image, or null if it can not be rendered.
tryToPng()  : string|null
Render a metafile as PNG data, or null if it can not be rendered.

Constants

MIMETYPE_EMF

public mixed MIMETYPE_EMF = 'image/x-emf'

MIMETYPE_WMF

public mixed MIMETYPE_WMF = 'image/x-wmf'

TYPE_EMF

public mixed TYPE_EMF = \PhpOffice\WMF\Reader\Detector::TYPE_EMF

TYPE_EMFPLUS

public mixed TYPE_EMFPLUS = \PhpOffice\WMF\Reader\Detector::TYPE_EMFPLUS

TYPE_WMF

public mixed TYPE_WMF = \PhpOffice\WMF\Reader\Detector::TYPE_WMF

Methods

detect()

Get the metafile type (TYPE_WMF, TYPE_EMF or TYPE_EMFPLUS) of some content, or null if it is not a metafile.

public static detect(string $content) : string|null
Parameters
$content : string
Return values
string|null

detectFile()

Get the metafile type (TYPE_WMF, TYPE_EMF or TYPE_EMFPLUS) of a file, or null if it is not a metafile.

public static detectFile(string $path) : string|null

Works with any path readable by file_get_contents, including zip:// paths.

Parameters
$path : string
Return values
string|null

getExtension()

Get the file extension for a metafile type ("wmf" or "emf").

public static getExtension(string $type) : string
Parameters
$type : string
Return values
string

getMimeType()

Get the mime type for a metafile type.

public static getMimeType(string $type) : string
Parameters
$type : string
Return values
string

toGdImage()

Render a metafile as a GD image.

public static toGdImage(string $content) : GdImage
Parameters
$content : string
Tags
throws
Exception
Return values
GdImage

toPng()

Render a metafile as PNG data.

public static toPng(string $content) : string
Parameters
$content : string
Tags
throws
Exception
Return values
string

tryToGdImage()

Render a metafile as a GD image, or null if it can not be rendered.

public static tryToGdImage(string|null $content) : GdImage|null
Parameters
$content : string|null
Return values
GdImage|null

tryToPng()

Render a metafile as PNG data, or null if it can not be rendered.

public static tryToPng(string|null $content) : string|null
Parameters
$content : string|null
Return values
string|null

        
On this page

Search results