PHP Класс 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
Показать файл
Открыть проект
Примеры использования класса
Открытые свойства
Свойство |
Тип |
Описание |
|
$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. |
|
Открытые методы
Метод |
Описание |
|
create ( string $filename = null, $options = [], $isDataStream = false ) : GdThumb |
Factory Function |
|
Описание методов
create()
публичный статический Метод
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] |
Результат |
GdThumb |
|
Описание свойств
$defaultImplemenation публичное статическое свойство
Currently, valid options are:
- imagick
- gd
These are defined in the implementation map variable, inside the create function
public static string $defaultImplemenation |
Результат |
string |
|
$pluginPath публичное статическое свойство
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 |
Результат |
string |
|