Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class Image

This class is used to treat images. This class can resize images, or compress them

Direct known subclasses

Hawk\GifImage, Hawk\JpegImage, Hawk\PngImage

Abstract
Namespace: Hawk
Package: Utils
Located at Image.php

Methods summary

public static Hawk\Image
# getInstance( string $filename )

Create a new Image instance

Create a new Image instance

Parameters

$filename
The file path of the image

Returns

Hawk\Image
The image instance
protected
# __construct( string $filename, array $data )

Constructor

Constructor

Parameters

$filename
The file path of the image
$data
The data of the file (width, height, type, mime type)
public string
# getFilename( )

Return the filename of the image

Return the filename of the image

Returns

string
The file path of the image
public integer
# getWidth( )

Return the width of the image

Return the width of the image

Returns

integer
The width (in pixels) of the image
public integer
# getHeight( )

Return the height of the image

Return the height of the image

Returns

integer
The height (in pixels) if the image
public integer
# getType( )

Return the type of the image

Return the type of the image

Returns

integer
The type of the image : IMAGETYPE_GIF, IMAGETYPE_PNG, or IMAGETYPE_JPEG
public string
# getMimeType( )

Return the mime type of the image

Return the mime type of the image

Returns

string
The mime type of the image
public integer
# getFileSize( )

Return the file size of the image

Return the file size of the image

Returns

integer
The file size (in bytes) of the image
public string
# getExtension( )

Return the file extension of the image, depending on the type of the image, not the image file

Return the file extension of the image, depending on the type of the image, not the image file

Returns

string
The extension of the image
public Hawk\Image
# resize( integer $width, integer $height, string $filename )

Resize the image

Resize the image

Parameters

$width
The new width of the image (in pixels)
$height
The new height of the image (in pixels)
$filename
The path of the file to save the resized image

Returns

Hawk\Image
The new resized image
abstract public Hawk\Image
# compress( float $rate, string $filename )

Compress the image

Compress the image

Parameters

$rate
The rate compression, between 0 and 1
$filename
The path where to save the new compressed file

Returns

Hawk\Image
The compressed image

Properties summary

protected $width

The width of the image

The width of the image

#
protected $height

The height of the image

The height of the image

#
protected $type

The type of the image : IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG

The type of the image : IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_JPEG

#
protected $mime

The mime type of the image

The mime type of the image

#
protected $filename

The filename of the image

The filename of the image

#
Hawk - PHP documentation API documentation generated by ApiGen