PHP Class PhpThumbFactory, thinksns
This class is responsible for making sure everything is set up and initialized properly,
and returning the appropriate thumbnail class instance. It is the only recommended way
of using this library, and if you try and circumvent it, the sky will fall on your head :)
Basic use is easy enough. First, make sure all the settings meet your needs and environment...
these are the static variables defined at the beginning of the class.
Once that's all set, usage is pretty easy. You can simply do something like:
$thumb = PhpThumbFactory::create('/path/to/file.png');
Refer to the documentation for the create function for more information
显示文件
Open project: medz/thinksns-4
Class Usage Examples
Public Properties
Property |
Type |
Description |
|
$defaultImplemenation |
string |
Currently, valid options are:
- imagick
- gd
These are defined in the implementation map variable, inside the create function |
|
$pluginPath |
string |
Note, it's important that this path is properly defined. It is very likely that you'll
have to change this, as the assumption here is based on a relative path. |
|
Public Methods
Method |
Description |
|
create ( string $filename = null, $options = [], $isDataStream = false ) : GdThumb |
Factory Function |
|
Method Details
create()
public static method
This function returns the correct thumbnail object, augmented with any appropriate plugins.
It does so by doing the following:
- Getting an instance of PhpThumb
- Loading plugins
- Validating the default implemenation
- Returning the desired default implementation if possible
- Returning the GD implemenation if the default isn't available
- Throwing an exception if no required libraries are present
public static create ( string $filename = null, $options = [], $isDataStream = false ) : GdThumb |
$filename |
string |
The path and file to load [optional] |
return |
GdThumb |
|
Property Details
$defaultImplemenation public_oe static_oe property
Currently, valid options are:
- imagick
- gd
These are defined in the implementation map variable, inside the create function
public static string $defaultImplemenation |
return |
string |
|
$pluginPath public_oe static_oe property
Note, it's important that this path is properly defined. It is very likely that you'll
have to change this, as the assumption here is based on a relative path.
public static string $pluginPath |
return |
string |
|