52 lines
996 B
PHP
52 lines
996 B
PHP
<?php
|
|
|
|
|
|
abstract class phImaginator_Merge extends phImaginator_Universal implements phImaginator_Module {
|
|
|
|
|
|
protected static $runCollected = true;
|
|
|
|
|
|
public static function fitted($params) {
|
|
require_once 'phImaginator.Box.class.php';
|
|
|
|
self::universalMerger('fitted', $params);
|
|
}
|
|
|
|
|
|
private static function universalMerger($type, $params) {
|
|
$width = $params[0];
|
|
$height = $params[1];
|
|
|
|
$lucency = ($params[2]) ? $params[2] : 50;
|
|
|
|
if (is_array(parent::$imageSourceCollection)) {
|
|
|
|
$mergedImage = imagecreatetruecolor($width, $height);
|
|
|
|
$iteratorCnt = 0;
|
|
|
|
foreach (parent::$imageSourceCollection as $image_data) {
|
|
if ($type == 'fitted') {
|
|
phImaginator_Box::fit($image_data, array($width, $height));
|
|
}
|
|
|
|
$useLucency = (++$iteratorCnt > 1) ? $lucency : 100;
|
|
|
|
imagecopymerge($mergedImage, $image_data['resource'], 0, 0, 0, 0, $image_data['width'], $image_data['height'], $useLucency);
|
|
}
|
|
|
|
parent::replaceSourceCollection($mergedImage);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|