[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> gdlib.php (summary)

gdlib.php - Collection of routines in Moodle related to processing images using GD

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 407 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 5 functions

  imagecopybicubic()
  process_new_icon()
  generate_image_thumbnail()
  generate_image_thumbnail_from_string()
  generate_image_thumbnail_from_image()

Functions
Functions that are not part of a class:

imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)   X-Ref
Copies a rectangular portion of the source image to another rectangle in the destination image

This function calls imagecopyresampled() if it is available and GD version is 2 at least.
Otherwise it reimplements the same behaviour. See the PHP manual page for more info.

param: resource $dst_img the destination GD image resource
param: resource $src_img the source GD image resource
param: int $dst_x vthe X coordinate of the upper left corner in the destination image
param: int $dst_y the Y coordinate of the upper left corner in the destination image
param: int $src_x the X coordinate of the upper left corner in the source image
param: int $src_y the Y coordinate of the upper left corner in the source image
param: int $dst_w the width of the destination rectangle
param: int $dst_h the height of the destination rectangle
param: int $src_w the width of the source rectangle
param: int $src_h the height of the source rectangle
return: bool tru on success, false otherwise

process_new_icon($context, $component, $filearea, $itemid, $originalfile, $preferpng = false)   X-Ref
Stores optimised icon images in icon file area.

Since 2.9 this function will generate an icon in the same format as the original file when possible.
To counter that behaviour, you can use the argument $preferpng to generate a PNG icon.

param: context $context
param: string $component
param: string filearea
param: int $itemid
param: string $originalfile
param: boolean $preferpng When true, it will try to generate a PNG file regardless of the original file.
return: mixed new unique revision number or false if not saved

generate_image_thumbnail($filepath, $width, $height)   X-Ref
Generates a thumbnail for the given image

If the GD library has at least version 2 and PNG support is available, the returned data
is the content of a transparent PNG file containing the thumbnail. Otherwise, the function
returns contents of a JPEG file with black background containing the thumbnail.

param: string $filepath the full path to the original image file
param: int $width the width of the requested thumbnail
param: int $height the height of the requested thumbnail
return: string|bool false if a problem occurs, the thumbnail image data otherwise

generate_image_thumbnail_from_string($filedata, $width, $height)   X-Ref
Generates a thumbnail for the given image string.

If the GD library has at least version 2 and PNG support is available, the returned data
is the content of a transparent PNG file containing the thumbnail. Otherwise, the function
returns contents of a JPEG file with black background containing the thumbnail.

param: string $filedata The image content as a string
param: int $width the width of the requested thumbnail
param: int $height the height of the requested thumbnail
return: string|bool false if a problem occurs, the thumbnail image data otherwise

generate_image_thumbnail_from_image($original, $imageinfo, $width, $height)   X-Ref
Generates a thumbnail for the given image string.

If the GD library has at least version 2 and PNG support is available, the returned data
is the content of a transparent PNG file containing the thumbnail. Otherwise, the function
returns contents of a JPEG file with black background containing the thumbnail.

param: string $original The image content as a string
return: string|bool false if a problem occurs, the thumbnail image data otherwise



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1