## /image.php

Description

This script implements utility functions for working with images.

Phorum does not require this API for the core features. It is mainly provided to offer module writers are stable and powerful API for working with images.

- copyright: 2007, Phorum Development Team
- license: Phorum

Functions
phorum_api_image_thumbnail (line 84)

Create an image thumbnail.

This function can be used to create a scaled down thumbnail version of an image. You can specifiy a width and/or a height to which to scale down the image. The aspect ratio will always be kept. If both a width and height are provided, then the one which requires the largest scale down will be leading.

- return:

  NULL is returned in case creating the thumbnail failed. The function phorum_api_strerror() can be used to retrieve information about the error which occurred.

  An array is returned in case creating the thumbnail did work. This array contains the following fields:

  - image: The scaled down image. NULL if no scaling was needed.
  - method: The method that was used to create the thumbnail.
  - cur_w: The width of the original $image.
  - cur_h: The height of the original $image.
  - cur_mime: The MIME type of the original $image.
  - new_w: The width of the scaled down image.
  - new_h: The height of the scaled down image.
  - new_mime: The MIME type of the scaled down image,

mixed phorum_api_image_thumbnail (string $image, [integer $max_w = NULL], [integer $max_h = NULL], [string $method = NULL])

- string $image: The raw binary image data.
- integer $max_w: The maximum allowed width for the image in pixels. Use NULL or 0 (zero) to indicate that any width will do.
- integer $max_h: The maximum allowed height for the image in pixels. Use NULL or 0 (zero) to indicate that any height will do.
- string $method: The method to use for scaling the image. By default, this function will try to autodetect a working method. Providing a $method parameter is mostly useful for debugging purposes. Available methods (in the order in which they are probed in the code) are:
  - gd: using the GD library (requires extension "gd")
  - imagick: using the ImageMagick library (requires extension "imagick")
  - convert: using the ImageMagick "convert" tool (requires the ImageMagick package to be installed on the server, does not work in combination with some PHP safety restrictions).

Documentation generated on Mon, 13 Oct 2008 01:45:25 -0500 by phpDocumentor 1.4.1