예제 #1
0
<?php

$list = new Asset_Image_Thumbnail_List();
$list->load();
$thumbnails = array();
foreach ($list->getThumbnails() as $thumbnail) {
    $pipe = new Asset_Image_Thumbnail_Config();
    $pipe->setName($thumbnail->getName());
    $pipe->setDescription($thumbnail->getDescription());
    $pipe->setFormat($thumbnail->getFormat());
    $pipe->setQuality($thumbnail->getQuality());
    if ($thumbnail->getCover()) {
        $pipe->addItem("cover", array("width" => $thumbnail->getWidth(), "height" => $thumbnail->getHeight(), "positioning" => "center"));
    } else {
        if ($thumbnail->getContain()) {
            $pipe->addItem("contain", array("width" => $thumbnail->getWidth(), "height" => $thumbnail->getHeight()));
        } else {
            if ($thumbnail->getAspectratio()) {
                if ($thumbnail->getHeight() > 0 && $thumbnail->getWidth() > 0) {
                    $pipe->addItem("contain", array("width" => $thumbnail->getWidth(), "height" => $thumbnail->getHeight()));
                } else {
                    if ($thumbnail->getHeight() > 0) {
                        $pipe->addItem("scaleByHeight", array("height" => $thumbnail->getHeight()));
                    } else {
                        $pipe->addItem("scaleByWidth", array("width" => $thumbnail->getWidth()));
                    }
                }
            } else {
                $pipe->addItem("resize", array("width" => $thumbnail->getWidth(), "height" => $thumbnail->getHeight()));
            }
        }