Skip to content

Instantly share code, notes, and snippets.

@skylarkcob
Last active August 29, 2015 13:57
Show Gist options
  • Save skylarkcob/9796871 to your computer and use it in GitHub Desktop.
Save skylarkcob/9796871 to your computer and use it in GitHub Desktop.
Hướng dẫn sử dụng BFIThumb để thay đổi kích thước hình ảnh.
require_once('BFI_Thumb.php');
$params = array( 'width' => 400 );
echo "<img src='" . bfi_thumb( "URL-to-image.jpg", $params ) . "'/>";
// Resize by width only
$params = array( 'width' => 400 );
bfi_thumb( "URL-to-image.jpg", $params );
// Resize by width and height
$params = array( 'width' => 400, 'height' => 300 );
bfi_thumb( "URL-to-image.jpg", $params );
// Crop
$params = array( 'width' => 400, 'height' => 300, 'crop' => true );
bfi_thumb( "URL-to-image.jpg", $params );
// Change opacity (makes your image into a PNG)
$params = array( 'opacity' => 80 ); // 80% opaque
bfi_thumb( "URL-to-image.jpg", $params );
// Grayscale
$params = array( 'grayscale' => true );
bfi_thumb( "URL-to-image.jpg", $params );
// Colorize
$params = array( 'color' => '#ff0000' );
bfi_thumb( "URL-to-image.jpg", $params );
// Negate
$params = array( 'negate' => true );
bfi_thumb( "URL-to-image.jpg", $params );
// Multiple parameters
$params = array( 'width' => 400, 'height' => 300, 'opacity' => 50, 'grayscale' => true, 'colorize' => '#ff0000' );
bfi_thumb( "URL-to-image.jpg", $params );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment