You are here

function imce_create_thumbnail in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.page.inc \imce_create_thumbnail()
  2. 6 inc/page.inc \imce_create_thumbnail()

Create a thumbnail.

1 call to imce_create_thumbnail()
imce_create_thumbnails in inc/imce.page.inc
Create all selected thumbnails.

File

inc/imce.page.inc, line 514
Implements the file browser.

Code

function imce_create_thumbnail($filename, &$imce, $thumbnail) {

  // Generate thumbnail name.
  $name = $thumbnail['prefix'];
  if ($thumbnail['suffix'] != '' && ($dot = strrpos($filename, '.'))) {
    $name .= substr($filename, 0, $dot);
    $name .= $thumbnail['suffix'];
    $name .= substr($filename, $dot);
  }
  else {
    $name .= $filename;
  }

  // Scale the image.
  list($width, $height) = explode('x', $thumbnail['dimensions']);
  return imce_resize_image($filename, $imce, $width, $height, TRUE, $name, variable_get('imce_settings_thumb_method', 'scale_and_crop'));
}