PHP Classes

File: docs/convert_image.md

Recommend this page to a friend!
  Classes of Chun-Sheng, Li   Selective PHP Image Manipulation   docs/convert_image.md   Download  
File: docs/convert_image.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Selective PHP Image Manipulation
Perform several types of image manipulation
Author: By
Last change:
Date: 1 year ago
Size: 895 bytes
 

Contents

Class file image Download

Convert Image

In this sample, you will learn how to convert the image to the specific image type.

Convert image to the BMP 16 image

$image = new Image();
$imgSrc = $image->getImage('/path/to/image.png');
$imageDataString = $image->convertImageToBmp16($imgSrc);

Convert image to the BMP 24 image

$image = new Image();
$imgSrc = $image->getImage('/path/to/image.png');
$resizedImageResource = $image->convertImageToBmp24($imgSrc);

Convert image from image resource

This sample code will be automatic to output specific image file.

$image = new Image();
$imgSrc = $image->getImage('/path/to/image.png');
$resultBoolean = $image->convertImage($imgSrc, '/path/to/output.jpg');

Convert image from image file

$image = new Image();
$imgSrc = '/path/to/image.png';
$resultBoolean = $image->convertFile($imgFile, '/path/to/output.jpg');