/sources/images.php

Description
Functions
check_memory_limit_for (line 161)

Check we can load the given file, given our memory limit.

void check_memory_limit_for (PATH $file_path_stub)
  • PATH $file_path_stub: The file path we are trying to load
convert_image (line 203)

Resize an image to the specified size, but retain the aspect ratio.

  • return: Success
boolean convert_image (URLPATH $from, PATH $to, integer $width, integer $height, [integer $box_width = -1], [boolean $exit_on_error = true], [?string $ext2 = NULL], [boolean $using_path = false], [boolean $only_make_smaller = false], [?array $thumb_options = NULL])
  • URLPATH $from: The URL to the image to resize
  • PATH $to: The file path (including filename) to where the resized image will be saved
  • integer $width: The maximum width we want our new image to be (-1 means "don't factor this in")
  • integer $height: The maximum height we want our new image to be (-1 means "don't factor this in")
  • integer $box_width: This is only considered if both $width and $height are -1. If set, it will fit the image to a box of this dimension (suited for resizing both landscape and portraits fairly)
  • boolean $exit_on_error: Whether to exit ocPortal if an error occurs
  • ?string $ext2: The file extension to save with (NULL: same as our input file)
  • boolean $using_path: Whether $from was in fact a path, not a URL
  • boolean $only_make_smaller: Whether to apply a 'never make the image bigger' rule for thumbnail creation (would affect very small images)
  • ?array $thumb_options: This optional parameter allows us to specify cropping or padding for the image. See comments in the function. (NULL: no details passed)
do_image_thumb (line 52)

Get the tempcode for an image thumbnail.

  • return: The thumbnail
tempcode do_image_thumb (URLPATH $url, mixed $caption, [boolean $js_tooltip = false], [boolean $is_thumbnail_already = true], [integer $width = 90], [integer $height = 90])
  • URLPATH $url: The URL to the image thumbnail
  • mixed $caption: The caption for the thumbnail (string or Tempcode)
  • boolean $js_tooltip: Whether to use a JS tooltip. Forcibly set to true if you pass Tempcode
  • boolean $is_thumbnail_already: Whether already a thumbnail (if not, function will make one)
  • integer $width: Thumbnail width to use
  • integer $height: Thumbnail height to use
ensure_thumbnail (line 95)

Take some image/thumbnail info, and if needed make and caches a thumbnail, and return a thumb url whatever the situation.

  • return: The URL to the thumbnail
URLPATH ensure_thumbnail (URLPATH $full_url, URLPATH $thumb_url, ID_TEXT $thumb_dir, ID_TEXT $table, AUTO_LINK $id, [ID_TEXT $thumb_field_name = 'thumb_url'], [?integer $thumb_width = NULL])
  • URLPATH $full_url: The full URL to the image which will-be/is thumbnailed
  • URLPATH $thumb_url: The URL to the thumbnail (blank: no thumbnail yet)
  • ID_TEXT $thumb_dir: The directory, relative to the ocPortal install, where the thumbnails are stored. MINUS "_thumbs"
  • ID_TEXT $table: The name of the table that is storing what we are doing the thumbnail for
  • AUTO_LINK $id: The ID of the table record that is storing what we are doing the thumbnail for
  • ID_TEXT $thumb_field_name: The name of the table field where thumbnails are saved
  • ?integer $thumb_width: The thumbnail width to use (NULL: default)
get_gd_version (line 546)

Get the version number of GD on the system. It should only be called if GD is known to be on the system, and in use

  • return: The version of GD installed
float get_gd_version ()
get_max_image_size (line 26)

Get the maximum allowed image size, as set in the configuration.

  • return: The maximum image size
integer get_max_image_size ()
is_image (line 581)

Find whether the image specified is actually an image, based on file extension

  • return: Whether the string pointed to a file appeared to be an image
boolean is_image (string $name)
  • string $name: A URL or file path to the image
is_saveable_image (line 614)

Use the image extension to determine if the specified image is of a format (extension) saveable by ocPortal or not.

  • return: Whether the string pointed to a file that appeared to be a saveable image
boolean is_saveable_image (string $name)
  • string $name: A URL or file path to the image
is_video (line 598)

Find whether the video specified is actually an video, based on file extension

  • return: Whether the string pointed to a file appeared to be a video
boolean is_video (string $name)
  • string $name: A URL or file path to the video

Documentation generated on Sun, 02 Jan 2011 23:15:58 +0000 by phpDocumentor 1.4.3