Drupal 8  8.0.2
GDToolkit Class Reference
Inheritance diagram for GDToolkit:

Public Member Functions

 __construct (array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager)
 
 __destruct ()
 
 setResource ($resource)
 
 getResource ()
 
 buildConfigurationForm (array $form, FormStateInterface $form_state)
 
 submitConfigurationForm (array &$form, FormStateInterface $form_state)
 
 isValid ()
 
 save ($destination)
 
 parseFile ()
 
 getTransparentColor ()
 
 getWidth ()
 
 getHeight ()
 
 getType ()
 
 setType ($type)
 
 getMimeType ()
 
 getRequirements ()
 
 extensionToImageType ($extension)
 
- Public Member Functions inherited from ImageToolkitBase
 __construct (array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory)
 
 validateConfigurationForm (array &$form, FormStateInterface $form_state)
 
 setSource ($source)
 
 getSource ()
 
 getRequirements ()
 
 apply ($operation, array $arguments=array())
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from PluginFormInterface
 buildConfigurationForm (array $form, FormStateInterface $form_state)
 
 submitConfigurationForm (array &$form, FormStateInterface $form_state)
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static isAvailable ()
 
static getSupportedExtensions ()
 

Protected Member Functions

 load ()
 
- Protected Member Functions inherited from ImageToolkitBase
 getToolkitOperation ($operation)
 

Static Protected Member Functions

static supportedTypes ()
 

Protected Attributes

 $resource = NULL
 
 $type
 
 $preLoadInfo = NULL
 
 $streamWrapperManager
 
- Protected Attributes inherited from ImageToolkitBase
 $configFactory
 
 $source = ''
 
 $operationManager
 
 $logger
 

Detailed Description

Defines the GD2 toolkit for image manipulation within Drupal.

( id = "gd", title = ("GD2 image manipulation toolkit") )

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
array  $plugin_definition,
ImageToolkitOperationManagerInterface  $operation_manager,
LoggerInterface  $logger,
ConfigFactoryInterface  $config_factory,
StreamWrapperManagerInterface  $stream_wrapper_manager 
)

Constructs a GDToolkit object.

Parameters
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin_id for the plugin instance.
array$plugin_definitionThe plugin implementation definition.
\Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface$operation_managerThe toolkit operation manager.
\Psr\Log\LoggerInterface$loggerA logger instance.
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe config factory.
\Drupal\Core\StreamWrapper\StreamWrapperManagerInterface$stream_wrapper_managerThe StreamWrapper manager.
__destruct ( )

Destructs a GDToolkit object.

Frees memory associated with a GD image resource.

Member Function Documentation

buildConfigurationForm ( array  $form,
FormStateInterface  $form_state 
)

{}

References Drupal\configFactory(), and t().

Here is the call graph for this function:

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

extensionToImageType (   $extension)

Returns the IMAGETYPE_xxx constant for the given extension.

This is the reverse of the image_type_to_extension() function.

Parameters
string$extensionThe extension to get the IMAGETYPE_xxx constant for.
Returns
int The IMAGETYPE_xxx constant for the given extension, or IMAGETYPE_UNKNOWN for unsupported extensions.
See Also
image_type_to_extension()

References GDToolkit\supportedTypes().

Here is the call graph for this function:

getHeight ( )

{Returns the height of the image.

Returns
int|null The height of the image, or NULL if the image is invalid.
}

Implements ImageToolkitInterface.

References GDToolkit\getResource().

Here is the call graph for this function:

getMimeType ( )

{Returns the MIME type of the image file.

Returns
string The MIME type of the image file, or an empty string if the image is invalid.
}

Implements ImageToolkitInterface.

References GDToolkit\getType().

Here is the call graph for this function:

getRequirements ( )

{Gets toolkit requirements in a format suitable for hook_requirements().

Returns
array An associative requirements array as is returned by hook_requirements(). If the toolkit claims no requirements to the system, returns an empty array. The array can have arbitrary keys and they do not have to be prefixed by e.g. the module name or toolkit ID, as the system will make the keys globally unique.
See Also
hook_requirements()
}

Implements ImageToolkitInterface.

References t().

Here is the call graph for this function:

getResource ( )

Retrieves the GD image resource.

Returns
resource|null The GD image resource, or NULL if not available.

References GDToolkit\load().

Referenced by GDToolkit\getHeight(), GDToolkit\getTransparentColor(), GDToolkit\getWidth(), GDToolkit\load(), and GDToolkit\save().

Here is the call graph for this function:

Here is the caller graph for this function:

static getSupportedExtensions ( )
static

{Returns a list of image file extensions supported by the toolkit.

Returns
array An array of supported image file extensions (e.g. png/jpeg/gif).
}

Implements ImageToolkitInterface.

References Unicode\strtolower().

Here is the call graph for this function:

getTransparentColor ( )

Gets the color set for transparency in GIF images.

Returns
string|null A color string like '#rrggbb', or NULL if not set or not relevant.

References GDToolkit\getResource(), GDToolkit\getType(), and Color\rgbToHex().

Referenced by GDToolkit\load().

Here is the call graph for this function:

Here is the caller graph for this function:

getType ( )

Gets the PHP type of the image.

Returns
int The image type represented by a PHP IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG).

Referenced by GDToolkit\getMimeType(), GDToolkit\getTransparentColor(), GDToolkit\load(), and GDToolkit\save().

Here is the caller graph for this function:

getWidth ( )

{Returns the width of the image.

Returns
int|null The width of the image, or NULL if the image is invalid.
}

Implements ImageToolkitInterface.

References GDToolkit\getResource().

Here is the call graph for this function:

static isAvailable ( )
static

{Verifies that the Image Toolkit is set up correctly.

Returns
bool TRUE if the toolkit is available on this machine, FALSE otherwise.
}

Implements ImageToolkitInterface.

isValid ( )

{Checks if the image is valid.

Returns
bool TRUE if the image toolkit is currently handling a valid image, FALSE otherwise.
}

Implements ImageToolkitInterface.

Referenced by GDToolkit\load().

Here is the caller graph for this function:

load ( )
protected

Loads a GD resource from a file.

Returns
bool TRUE or FALSE, based on success.

References ImageToolkitBase\apply(), GDToolkit\getResource(), ImageToolkitBase\getSource(), GDToolkit\getTransparentColor(), GDToolkit\getType(), GDToolkit\isValid(), and GDToolkit\setResource().

Referenced by GDToolkit\getResource().

Here is the call graph for this function:

Here is the caller graph for this function:

parseFile ( )

{Determines if a file contains a valid image.Drupal supports GIF, JPG and PNG file formats when used with the GD toolkit, and may support others, depending on which toolkits are installed.

Returns
bool TRUE if the file could be found and is an image, FALSE otherwise.
}

Implements ImageToolkitInterface.

References ImageToolkitBase\getSource(), and GDToolkit\setType().

Here is the call graph for this function:

save (   $destination)

{Writes an image resource to a destination file.

Parameters
string$destinationA string file URI or path where the image should be saved.
Returns
bool TRUE on success, FALSE on failure.
}

Implements ImageToolkitInterface.

References Drupal\configFactory(), drupal_realpath(), drupal_tempnam(), FILE_EXISTS_REPLACE, file_stream_wrapper_valid_scheme(), file_unmanaged_move(), file_uri_scheme(), GDToolkit\getResource(), GDToolkit\getType(), and StreamWrapperInterface\LOCAL.

Referenced by GDToolkit\submitConfigurationForm().

Here is the call graph for this function:

Here is the caller graph for this function:

setResource (   $resource)

Sets the GD image resource.

Parameters
resource$resourceThe GD image resource.
Returns
An instance of the current toolkit object.

Referenced by GDToolkit\load().

Here is the caller graph for this function:

setType (   $type)

Sets the PHP type of the image.

Parameters
int$typeThe image type represented by a PHP IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG).
Returns
$this

Referenced by GDToolkit\parseFile().

Here is the caller graph for this function:

submitConfigurationForm ( array &  $form,
FormStateInterface  $form_state 
)

{}

References Drupal\configFactory(), and GDToolkit\save().

Here is the call graph for this function:

static supportedTypes ( )
staticprotected

Returns a list of image types supported by the toolkit.

Returns
array An array of available image types. An image type is represented by a PHP IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG, IMAGETYPE_PNG, etc.).

Referenced by GDToolkit\extensionToImageType().

Here is the caller graph for this function:


The documentation for this class was generated from the following file: