( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/..//tmpr/../tmpr/..//tmpr/../brandMagick.php
<?php 
function thumbGenerator($dir,$tmpName,$fileType,$size){
    $saveFileType = "png";
    $imagePath = $dir.$tmpName.".".$fileType;
    $image = new Imagick();
    $image->readimage($imagePath);
    if($fileType == "psd"){
        $image->setIteratorIndex(0);
    }
    $dimensions = $image->getImageGeometry();
    $width = $dimensions['width'];
    $height = $dimensions['height'];
    if($size == "large"){
        $maxWidth = 720;
        $maxHeight =720;
    }
    if($size == "small"){
        $maxWidth = 250;
        $maxHeight =250;
    }
    if($height > $width){
        //Portrait
        if($height > $maxHeight)
            $image->thumbnailImage(0, $maxHeight);
            $dimensions = $image->getImageGeometry();
            if($dimensions['width'] > $maxWidth){
                $image->thumbnailImage($maxWidth, 0);
            }
    }elseif($height < $width){
        //Landscape
        $image->thumbnailImage($maxWidth, 0);
    }else{
        //square
        $image->thumbnailImage($maxWidth, 0);
    }
    if($size == "large"){
        $image->writeImage($dir . $tmpName."-lg.".$saveFileType);
    }
    if($size == "small"){
        $image->writeImage($dir . $tmpName."-sm.".$saveFileType);;
    }
}


/*$dir - directory to save to.
$tmpName - the name to name the file excluding the extension.
$fileType - self explanatory.
$size - Large or small.*/

$dir="brandMagick";
$tmpName="my";
$fileType="png";
$size="large";
thumbGenerator($dir,$tmpName,$fileType,$size);

?>