当前位置: 首页>>代码示例>>PHP>>正文


PHP SimpleImage::fit_to_width方法代码示例

本文整理汇总了PHP中SimpleImage::fit_to_width方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleImage::fit_to_width方法的具体用法?PHP SimpleImage::fit_to_width怎么用?PHP SimpleImage::fit_to_width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleImage的用法示例。


在下文中一共展示了SimpleImage::fit_to_width方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: elseif

 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'] . "'");
     $insertCategoryId = mysql_insert_id();
 }
 mysql_query("INSERT INTO vbilder SET bildName='" . $newName . "',bildFile='" . $newName . "',bildKat='" . $insertCategoryId . "'");
 $imageId = mysql_insert_id();
 if (!empty($_POST['_createGallery']) && $i == 1) {
     mysql_query("INSERT INTO vbildergalerien SET galName='" . mysql_escape_string($_POST['_galleryName']) . "',galBilder='" . $imageId . "'");
     $idInsertGallery = mysql_insert_id();
 } else {
     $query = mysql_query("SELECT * FROM vbildergalerien WHERE galID = '" . $idInsertGallery . "'");
     $row = mysql_fetch_array($query);
     $images = $row['galBilder'] . ';' . $imageId;
     mysql_query("UPDATE vbildergalerien SET galBilder='" . $images . "' WHERE galID='" . $idInsertGallery . "'");
开发者ID:satson,项目名称:2gm,代码行数:31,代码来源:ajax.php

示例2: SimpleImage

    $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);
}
开发者ID:roman1970,项目名称:lis,代码行数:31,代码来源:resize.php

示例3: resizeImage

 function resizeImage($source_image, $target_image, $width = 0, $height = 0, $best_fit = false)
 {
     $SimpleImage = new SimpleImage($source_image);
     if ($best_fit) {
         $SimpleImage->best_fit($width, $height)->save($target_image, 100);
     } else {
         if (!$width && !$height) {
             $SimpleImage->save($target_image);
         } elseif ($SimpleImage->get_width() >= $width) {
             $SimpleImage->fit_to_width($width)->crop(0, 0, $width, $SimpleImage->get_height() > $height ? $height : $SimpleImage->get_height())->save($target_image);
         } elseif ($SimpleImage->get_height() >= $height) {
             $SimpleImage->fit_to_width($height)->crop(0, 0, $SimpleImage->get_width() > $width ? $width : $SimpleImage->get_width(), $height)->save($target_image);
         } else {
             $SimpleImage->best_fit($width, $height)->save($target_image);
         }
     }
 }
开发者ID:rizwan-devbatch,项目名称:SampleCode,代码行数:17,代码来源:common_model.php

示例4: validateSponsorImage

 /**
  * Verify and validate the extension of the uploaded file.
  *
  * @param string $name
  * @param string $type
  * @return boolean
  */
 public function validateSponsorImage($name, $tmpName, $type)
 {
     $allowedExtensions = array("gif", "jpeg", "jpg", "png", "pdf", "GIF", "JPEG", "JPG", "PNG", "PDF");
     $temp = explode(".", $name);
     $extension = end($temp);
     if (($type === "image/gif" || $type === "image/jpeg" || $type === "image/jpg" || $type === "image/pjpeg" || $type === "image/x-png" || $type === "image/png" || $type === "application/pdf") && in_array($extension, $allowedExtensions)) {
         $img = new SimpleImage($tmpName);
         $img->fit_to_width(360);
         $img->invert();
         $img->crop(0, ($img->get_height() - 190) / 2, 360, ($img->get_height() - 190) / 2 + 190);
         $img->invert();
         $img->save("_temp/_img.png");
         return true;
     } else {
         return false;
     }
 }
开发者ID:KINOTO,项目名称:apymeco,代码行数:24,代码来源:SponsorModel.php


注:本文中的SimpleImage::fit_to_width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。