Skip to content

Instantly share code, notes, and snippets.

@sakirsensoy
Last active December 29, 2015 13:19
Show Gist options
  • Save sakirsensoy/7676629 to your computer and use it in GitHub Desktop.
Save sakirsensoy/7676629 to your computer and use it in GitHub Desktop.
imageTool'un kullanım örnekleri
<?php
use PosGen\ImageTool\ImageTool;
//örnek thumbnail oluşturma
$imageThumbs = ImageTool::open("a.jpg")
->thumbnail([
'width' => 50,
'height' => 50,
'savePath' => 'thumbs/50x50'
])
->thumbnail([
'width' => 100,
'height' => 100,
'savePath' => 'thumbs/100x100'
])
->thumbnail([
'width' => 150,
'height' => 150,
'savePath' => 'thumbs/150x150'
])
->save([
'mimeType' => 'image/png',
'autoNaming' => false
]);
//örnek resize
$imageResize = ImageTool::open("a.jpg")
->resize([
'width' => 200,
'height' => 300,
'option' => 'auto'
])
->save([
'savePath' => 'resizes',
'mimeType' => 'image/gif'
]);
//örnek crop
$imageCrop = ImageTool::open("a.jpg")
->crop([
'x' => 10,
'y' => 20,
'sourceWidth' => 150,
'sourceHeight' => 200,
'outputWidth' => 160,
'outputHeight' => 220
])
->save([
'savePath' => 'crops',
'name' => 'a_crop'
]);
//sonuçlar
var_dump($imageThumbs);
var_dump($imageResize);
var_dump($imageCrop);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment