Skip to content

Latest commit

 

History

History
302 lines (166 loc) · 6.85 KB

class.ImageManagerCore.md

File metadata and controls

302 lines (166 loc) · 6.85 KB

Class ImageManagerCore

This class includes functions for image manipulation

Contents

Methods

Methods

checkImageMemoryLimit

boolean ImageManagerCore::checkImageMemoryLimit($image)

Check if memory limit is too long or not

Arguments

  • $image mixed

create

resource ImageManagerCore::create(string $type, string $filename)

Create an image with GD extension from a given type

Arguments

  • $type string
  • $filename string

createWhiteImage

resource ImageManagerCore::createWhiteImage(integer $width, integer $height)

Create an empty image with white background

Arguments

  • $width integer
  • $height integer

cut

boolean ImageManagerCore::cut(array $src_file, string $dst_file, integer $dst_width, integer $dst_height, string $file_type, integer $dst_x, integer $dst_y)

Cut image

Arguments

  • $src_file array - Origin filename
  • $dst_file string - Destination filename
  • $dst_width integer - Desired width
  • $dst_height integer - Desired height
  • $file_type string
  • $dst_x integer
  • $dst_y integer

getMimeTypeByExtension

string ImageManagerCore::getMimeTypeByExtension(string $file_name)

Return the mime type by the file extension

Arguments

  • $file_name string

isCorrectImageFileExt

boolean ImageManagerCore::isCorrectImageFileExt($filename)

Check if image file extension is correct

Arguments

  • $filename mixed - real filename

isRealImage

boolean ImageManagerCore::isRealImage(string $filename, string $file_mime_type, array $mime_type_list)

Check if file is a real image

Arguments

  • $filename string - File path to check
  • $file_mime_type string - File known mime type (generally from $_FILES)
  • $mime_type_list array - Allowed MIME types

resize

boolean ImageManagerCore::resize(string $src_file, string $dst_file, integer $dst_width, integer $dst_height, string $file_type, $force_type)

Resize, cut and optimize image

Arguments

  • $src_file string - Image object from $_FILE
  • $dst_file string - Destination filename
  • $dst_width integer - Desired width (optional)
  • $dst_height integer - Desired height (optional)
  • $file_type string
  • $force_type mixed

thumbnail

string ImageManagerCore::thumbnail(string $image, string $cache_image, integer $size, string $image_type, boolean $disable_cache)

Generate a cached thumbnail for object lists (eg. carrier, order states.

..etc)

Arguments

  • $image string - Real image filename
  • $cache_image string - Cached filename
  • $size integer - Desired size
  • $image_type string - Image type
  • $disable_cache boolean - When turned on a timestamp will be added to the image URI to disable the HTTP cache

validateIconUpload

boolean|string ImageManagerCore::validateIconUpload(array $file, integer $max_file_size)

Validate icon upload

Arguments

  • $file array - Upload $_FILE value
  • $max_file_size integer - Maximum upload size

validateUpload

boolean|string ImageManagerCore::validateUpload(array $file, integer $max_file_size)

Validate image upload (check image type and weight)

Arguments

  • $file array - Upload $_FILE value
  • $max_file_size integer - Maximum upload size

write

boolean ImageManagerCore::write(string $type, resource $resource, string $filename)

Generate and write image

Arguments

  • $type string
  • $resource resource
  • $filename string