Fit to height (proportionally resize to specified height)
public fit_to_height ( integer $height ) : SimpleImage | ||
$height | integer | |
return | SimpleImage |
$query = mysql_query("SELECT * FROM vbildergalerien WHERE galID = '" . mysql_escape_string($_POST['_idGallery']) . "'"); $row = mysql_fetch_array($query); $images = $row['galBilder'] . ';' . $imageId; mysql_query("UPDATE vbildergalerien SET galBilder='" . $images . "' WHERE galID='" . mysql_escape_string($_POST['_idGallery']) . "'"); $idGallery = $_POST['_idGallery']; } $categoryID = $insertId; $status = null; } else { try { $newName = mktime() . 'crop_' . $value; $imageClass = new SimpleImage('../../../user_upload/' . $value); if (!empty($_POST['_height']) && !empty($_POST['_width'])) { $imageClass->resize($_POST['_width'], $_POST['_height']); } elseif (!empty($_POST['_height'])) { $imageClass->fit_to_height($_POST['_height']); } else { $imageClass->fit_to_width($_POST['_width']); } //$imageClass->contrast(50); $imageClass->save('../../../user_upload/' . $newName, $_POST['_quality']); $imageClass->resize(200, 200); $imageClass->save('../../../user_upload/thumb_200/' . $newName, 90); $imageClass1 = new SimpleImage('../../../user_upload/' . $newName); $imageClass1->fit_to_width(400); $imageClass1->save('../../../user_upload/thumb_400/' . $newName, $_POST['_quality']); $imageClass2 = new SimpleImage('../../../user_upload/' . $newName); $imageClass2->fit_to_width(800); $imageClass2->save('../../../user_upload/thumb_800/' . $newName, $_POST['_quality']); if ($i == 1) { mysql_query("INSERT INTO vbildkategorie SET katName='" . $_POST['_newCategory1'] . "',katParent='" . $_POST['_inCategory'] . "'");
$file = ''; } if (empty($file) || !file_exists($root . $file)) { $file = '/noimage.jpg'; } echo $file; exit; $fileRes = '/resize/' . $height . '/' . $width . '/' . $type . $file; $file = $root . $file; $fileRes = $root . $fileRes; if (!file_exists($fileRes)) { require_once $root . '/SimpleImage.php'; $simpleImage = new SimpleImage(); $simpleImage->load($file); switch ($type) { case 'no': $simpleImage->square_crop($height, $width); break; case 'w': $simpleImage->fit_to_width($width); break; case 'h': $simpleImage->fit_to_height($height); break; case 's': $simpleImage->resize($height, $width); break; } createFolders($fileRes); $simpleImage->save($fileRes); }