Documentation

FileOperation
in package

FileOperation Class

The FileOperation class provides methods for compressing and resizing images.

Table of Contents

Methods

compressImage()  : mixed
Compress and save an image.
resizeImage()  : mixed
Resize and save an image to a specific size.

Methods

compressImage()

Compress and save an image.

public compressImage(string $inputFile, string $outputFile[, int $quality = 80 ]) : mixed
Parameters
$inputFile : string

Path to the input image file.

$outputFile : string

Path to the output compressed image file.

$quality : int = 80

Compression quality (0-100), where 100 is the best quality.

Tags
throws
Exception

When an unsupported image type is encountered.

resizeImage()

Resize and save an image to a specific size.

public resizeImage(string $inputFile, string $outputFile, int $newWidth, int $newHeight[, int $quality = 80 ]) : mixed
Parameters
$inputFile : string

Path to the input image file.

$outputFile : string

Path to the output resized image file.

$newWidth : int

New width for the resized image.

$newHeight : int

New height for the resized image.

$quality : int = 80

Compression quality (0-100), where 100 is the best quality.

Tags
throws
Exception

When an unsupported image type is encountered.


        
On this page

Search results