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


PHP SimpleImage::resizeToHeight方法代码示例

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


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

示例1: imageProcess

function imageProcess($img_info)
{
    $file = $img_info['img_upload_url_temp'] . $img_info['img'];
    $sizeInfo = getimagesize($file);
    if (is_array($sizeInfo)) {
        include_once 'libraries/SimpleImage.php';
        $image = new SimpleImage();
        $image->load($file);
        $width = $sizeInfo[0];
        $height = $sizeInfo[1];
        //img thumb
        $img_thumb = $img_info['img_upload_url_thumb'] . $img_info['img'];
        if ($width <= IMAGE_THUMB_WIDTH && $height <= IMAGE_THUMB_HEIGHT) {
            copy($file, $img_thumb);
        } elseif ($width >= $height) {
            $image->resizeToWidth(IMAGE_THUMB_WIDTH);
            $image->save($img_thumb);
        } elseif ($width < $height) {
            $image->resizeToHeight(IMAGE_THUMB_HEIGHT);
            $image->save($img_thumb);
        }
        //img
        $img = $img_info['img_upload_url'] . $img_info['img'];
        if ($img_info['original'] == 1) {
            $image->load($file);
            if ($width >= $height && $width > IMAGE_MAX_WIDTH) {
                $image->resizeToWidth(IMAGE_MAX_WIDTH);
                $image->save($img);
            } elseif ($width <= $height && $height > IMAGE_MAX_HEIGHT) {
                $image->resizeToHeight(IMAGE_MAX_HEIGHT);
                $image->save($img);
            } else {
                copy($file, $img);
            }
            if (file_exists($file)) {
                unlink($file);
            }
        } else {
            if (copy($file, $img)) {
                if (file_exists($file)) {
                    unlink($file);
                }
            }
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:hieunhan1,项目名称:all-website-v5,代码行数:49,代码来源:controlUpload.php

示例2: resizeImagesInFolder

function resizeImagesInFolder($dir, $i)
{
    if (!is_dir('cover/' . $dir)) {
        toFolder('cover/' . $dir);
    }
    $files = scandir($dir);
    foreach ($files as $key => $file) {
        if ($file != '.' && $file != '..') {
            if (!is_dir($dir . '/' . $file)) {
                echo $dir . '/' . $file;
                $image = new SimpleImage();
                $image->load($dir . '/' . $file);
                if ($image->getHeight() < $image->getWidth()) {
                    $image->resizeToWidth(1920);
                } else {
                    $image->resizeToHeight(1920);
                }
                // $new = 'cover/' . $dir . '/'.$image->name;
                if ($i < 10) {
                    $new = 'cover/' . $dir . '/00' . $i . '.' . $image->type;
                } elseif ($i < 100) {
                    $new = 'cover/' . $dir . '/0' . $i . '.' . $image->type;
                } else {
                    $new = 'cover/' . $dir . '/' . $i . '.' . $image->type;
                }
                $image->save($new);
                echo ' ---------> ' . $new . '<br>';
                $i++;
            } else {
                resizeImagesInFolder($dir . '/' . $file, 1);
            }
        }
    }
}
开发者ID:locnd,项目名称:demo,代码行数:34,代码来源:resize.php

示例3: upload

 function upload()
 {
     if (!isset($_FILES['upload'])) {
         $this->directrender('S3/S3');
         return;
     }
     global $params;
     // Params to vars
     $client_id = '1b5cc674ae2f335';
     // Validations
     $this->startValidations();
     $this->validate($_FILES['upload']['error'] === 0, $err, 'upload error');
     $this->validate($_FILES['upload']['size'] <= 10 * 1024 * 1024, $err, 'size too large');
     // Code
     if ($this->isValid()) {
         $fname = $_FILES['upload']['tmp_name'];
         require_once $GLOBALS['dirpre'] . 'includes/S3/SimpleImage.php';
         $image = new SimpleImage();
         $this->validate($image->load($fname), $err, 'invalid image type');
         if ($this->isValid()) {
             if ($image->getHeight() > 1000) {
                 $image->resizeToHeight(1000);
             }
             $image->save($fname);
             function getMIME($fname)
             {
                 $finfo = finfo_open(FILEINFO_MIME_TYPE);
                 $mime = finfo_file($finfo, $fname);
                 finfo_close($finfo);
                 return $mime;
             }
             $filetype = explode('/', getMIME($fname));
             $valid_formats = array("jpg", "png", "gif", "jpeg");
             $this->validate($filetype[0] === 'image' and in_array($filetype[1], $valid_formats), $err, 'invalid image type');
             if ($this->isValid()) {
                 require_once $GLOBALS['dirpre'] . 'includes/S3/s3_config.php';
                 //Rename image name.
                 $actual_image_name = time() . "." . $filetype[1];
                 $this->validate($s3->putObjectFile($fname, $bucket, $actual_image_name, S3::ACL_PUBLIC_READ), $err, 'upload failed');
                 if ($this->isValid()) {
                     $reply = "https://{$bucket}.s3.amazonaws.com/{$actual_image_name}";
                     $this->success('image successfully uploaded');
                     $this->directrender('S3/S3', array('reply' => "up(\"{$reply}\");"));
                     return;
                 }
             }
         }
     }
     $this->error($err);
     $this->directrender('S3/S3');
 }
开发者ID:edwardshe,项目名称:sublite-1,代码行数:51,代码来源:S3Controller.php

示例4: xulyImage

function xulyImage($img, $urlImgTemp, $urlImg, $urlImgThumb, $original = 1)
{
    $file = $urlImgTemp . $img;
    $sizeInfo = getimagesize($file);
    if (is_array($sizeInfo)) {
        include_once 'libraries/SimpleImage.php';
        $image = new SimpleImage();
        $image->load($file);
        $width = $sizeInfo[0];
        $height = $sizeInfo[1];
        if ($width <= IMAGE_THUMB_WIDTH && $height <= IMAGE_THUMB_HEIGHT) {
            copy($file, $urlImgThumb . $img);
        } elseif ($width >= $height) {
            $image->resizeToWidth(IMAGE_THUMB_WIDTH);
            $image->save($urlImgThumb . $img);
        } elseif ($width < $height) {
            $image->resizeToHeight(IMAGE_THUMB_HEIGHT);
            $image->save($urlImgThumb . $img);
        }
        if ($original == 1) {
            $image->load($file);
            if ($width >= $height && $width > IMAGE_MAX_WIDTH) {
                $image->resizeToWidth(IMAGE_MAX_WIDTH);
                $image->save($urlImg . $img);
            } elseif ($width <= $height && $height > IMAGE_MAX_HEIGHT) {
                $image->resizeToHeight(IMAGE_MAX_HEIGHT);
                $image->save($urlImg . $img);
            } else {
                copy($file, $urlImg . $img);
            }
            if (file_exists($file)) {
                unlink($file);
            }
        } else {
            if (copy($file, $urlImg . $img)) {
                if (file_exists($file)) {
                    unlink($file);
                }
            }
        }
        return true;
    } else {
        return false;
    }
}
开发者ID:hieunhan1,项目名称:all-website-v5,代码行数:45,代码来源:controlAjaxAdmin.php

示例5: executeAvatar

 public function executeAvatar(HTTPRequest $request)
 {
     ini_set("memory_limit", '256M');
     $this->page->smarty()->assign('avatar', $this->_profilePro->getAvatar());
     if ($request->fileExists('avatar')) {
         $avatar = $request->fileData('avatar');
         if ($avatar['error'] == 0) {
             $simpleImage = new SimpleImage();
             $simpleImage->load($avatar['tmp_name']);
             if (!is_null($simpleImage->image_type)) {
                 $height = $simpleImage->getHeight();
                 $width = $simpleImage->getWidth();
                 if ($height > $width) {
                     $simpleImage->resizeToHeight(150);
                 } else {
                     $simpleImage->resizeToWidth(150);
                 }
                 $filename = time() . '.jpg';
                 $simpleImage->save($_SERVER['DOCUMENT_ROOT'] . $this->_userDir . $filename);
                 if ($this->_profilePro->getAvatar() != ProfilePro::AVATAR_DEFAULT_PRO) {
                     unlink($_SERVER['DOCUMENT_ROOT'] . $this->_profilePro->getAvatar());
                 }
                 $this->_profilePro->setAvatar($this->_userDir . $filename);
                 $this->_profileProManager->save($this->_profilePro);
                 $this->app->user()->setFlash('avatar-updated');
             } else {
                 $this->app->user()->setFlash('avatar-error');
             }
         } else {
             $this->app->user()->setFlash('avatar-error');
         }
         $this->app->httpResponse()->redirect('/profile-pro');
     }
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:34,代码来源:ProfileproController.class.php

示例6: foreach

 if (is_array($_FILES["file"]["error"])) {
     foreach ($_FILES["file"]["error"] as $key => $error) {
         if ($error == UPLOAD_ERR_OK) {
             $tmp_name = $_FILES["file"]["tmp_name"][$key];
             $name = $_FILES["file"]["name"][$key];
             move_uploaded_file($tmp_name, $uploadsDirectory . $hashtag . '-' . $name);
             $uploadedFiles[] = $hashtag . '-' . $name;
         }
     }
 }
 $image = new SimpleImage();
 foreach ($uploadedFiles as $upFiles) {
     //resizeImage
     $image->load($uploadsDirectory . $upFiles);
     $image->resizeToWidth(133);
     $image->resizeToHeight(110);
     $image->save($uploadsDirectoryThumb . $upFiles);
 }
 $category = explode(",", $_POST['inputCategory']);
 foreach ($category as $key => $val) {
     if ($val == "") {
         unset($category[$key]);
     } else {
         $cats = explode("-", $val);
         $category[$key] = $cats[1];
     }
 }
 $amenity = explode(",", $_POST['inputTags']);
 foreach ($amenity as $key => $val) {
     if ($val == "") {
         unset($amenity[$key]);
开发者ID:0x27,项目名称:Philippine-Tourism,代码行数:31,代码来源:add-new.php

示例7: savePhoto

 private function savePhoto(AnnouncementPro $announce, $target, $file)
 {
     if ($file['error'] == 0) {
         $simpleImage = new SimpleImage();
         $thumbnailsSimpleImage = new SimpleImage();
         $simpleImage->load($file['tmp_name']);
         $thumbnailsSimpleImage->load($file['tmp_name']);
         if (!is_null($simpleImage->image_type)) {
             $height = $simpleImage->getHeight();
             $width = $simpleImage->getWidth();
             //Redimensionnement de l'image original en format modéré
             if ($height > 1200 || $width > 1600) {
                 if ($height > $width) {
                     $simpleImage->resizeToHeight(1200);
                 } else {
                     $simpleImage->resizeToWidth(1600);
                 }
             }
             //Redimensionnement de l'image original en miniature
             if ($height > $width) {
                 $thumbnailsSimpleImage->resizeToHeight(300);
             } else {
                 $thumbnailsSimpleImage->resizeToWidth(300);
             }
             $filename = $target . '-' . time() . '.jpg';
             $thumbnails = AnnouncementPro::THUMBNAILS_PREFIX . $filename;
             $simpleImage->save($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $filename);
             $thumbnailsSimpleImage->save($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $thumbnails);
             $getMethod = 'get' . $target;
             $setMethod = 'set' . $target;
             if ($announce->{$getMethod}() != AnnouncementPro::IMAGE_DEFAULT && $announce->{$getMethod}() != '') {
                 unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . $announce->{$getMethod}());
                 unlink($_SERVER['DOCUMENT_ROOT'] . AnnouncementPro::ANNOUNCEMENT_PRO_DIRECTORY . $announce->id() . '/' . AnnouncementPro::THUMBNAILS_PREFIX . $announce->{$getMethod}());
             }
             $announce->{$setMethod}($filename);
         }
     }
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:38,代码来源:AnnouncementsproController.class.php

示例8: substr

                $boyutlar2 = mysql_fetch_array(mysql_query("select * from tlg_boyut where id='{$c}'"));
                $genislik = $boyutlar2["width"];
                $yukseklik = $boyutlar2["height"];
                $uzanti = substr($_FILES["resim"]["name"][$i], -4, 4);
                $klasor = "resimler/etkinlik/" . $genislik . "x" . $yukseklik . "/";
                $yeni_ad = $klasor . $nowdate . $saat . $uzanti;
                //klasorler oluşturuluyor
                //klasör açma
                if (is_dir($klasor)) {
                } else {
                    mkdir($klasor);
                    echo "<center>" . $klasor . ' Klasörü Oluşturuldu <i class="fa fa-check-square-o"></i></center>';
                }
                $image = new SimpleImage();
                $image->load($_FILES["resim"]["tmp_name"][$i]);
                $image->resizeToHeight($yukseklik);
                $image->save($yeni_ad);
                $sorgu = mysql_query("insert into tlg_etkinlikresim (resim_link,title,baslik_id,boyut,boyutkod) values ('{$yeni_ad}','{$aciklama}', '{$mid}' ,'{$c}','{$boyutkod}')");
            }
            if ($sorgu) {
                echo '<center>Veritabanına Eklendi.<i class="fa fa-check-square-o"></i></center>';
            } else {
                echo '<center>Kayıt sırasında hata oluştu!<i class="fa fa-frown-o"></i></center>';
            }
        }
    }
}
?>
<form action="" method="post" name="form1" enctype="multipart/form-data">
<?php 
$makaleid = $_GET["id"];
开发者ID:toolgaege,项目名称:guncel,代码行数:31,代码来源:etkinlikresimekle.php

示例9: getimagesize

            $imagef->resizeToHeight($height);
            $imagef->save($file);
            $w = getimagesize($file);
            if ($w[0] > $width) {
                $imagef->resizeToWidth($width);
                $imagef->save($file);
            }
        } else {
            if ($w[0] >= $w[1]) {
                $imagef = new SimpleImage();
                $imagef->load($file);
                $imagef->resizeToWidth($width);
                $imagef->save($file);
                $w = getimagesize($file);
                if ($w[1] > $height) {
                    $imagef->resizeToHeight($height);
                    $imagef->save($file);
                }
            }
        }
        $itemid = $fs->create_file_from_pathname($file_record, $file);
        unlink($file);
        $c++;
    }
}
if (@$_FILES['i_audio']) {
    $c = 0;
    foreach ($_FILES['i_audio']['tmp_name'] as $k => $v) {
        ///Delete old records
        //$fs->delete_area_files($contextmodule->id, 'mod_mediaboard', 'private', $k);
        $file_record = new stdClass();
开发者ID:e-rasvet,项目名称:mediaboard,代码行数:31,代码来源:edit.php

示例10: microtime

     mt_srand((double) microtime() * 1000000);
     while (strlen($fileName) < $len + 1) {
         $fileName .= $base[mt_rand(0, $max)];
     }
     //Determine the path to which we want to save this file
     //$newname = dirname(__FILE__).'/upload/'.$filename;
     //$newname = 'dirtpage/accounts/'.$filename;
     //$newname = 'dirtpage/html/accounts/'.$filename;
     $newName = '../pictures/' . $fileName . '.jpg';
     //Check if the file with the same name is already exists on the server
     if (!file_exists($newName)) {
         //Attempt to move the uploaded file to it's new place
         if (move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $newName)) {
             $image = new SimpleImage();
             $image->load($newName);
             $image->resizeToHeight(1000);
             $image->resizeToWidth(400);
             $image->save($newName);
             header('Location: http://www.dirtpage.com/page/?topic=' . $topic);
             mysql_query("INSERT INTO pictures (topic, picture, origin) VALUES('{$topic}', '{$fileName}',now()) ") or die(mysql_error());
             mysql_query("delete from postedon where topic = '{$topic}'") or die(mysql_error());
             mysql_query("INSERT INTO postedon\r\n(topic) VALUES('{$topic}')") or die(mysql_error());
         } else {
             echo "Error: A problem occurred during file upload!";
         }
     } else {
         echo "Error: File " . $_FILES["uploaded_file"]["name"] . " already exists";
     }
 } else {
     echo "Error: Only .jpg images under 10mb are accepted for upload";
     echo "size: " . $_FILES["uploaded_file"]["size"];
开发者ID:jyano,项目名称:merge,代码行数:31,代码来源:upload.php

示例11: tempnam

     $destino_temporal = tempnam("tmp/", "tmp");
     marcadeagua($origen, $marcadeagua, $destino_temporal, 100);
     // guardamos la imagen
     $fp = fopen($destino, "w");
     fputs($fp, fread(fopen($destino_temporal, "r"), filesize($destino_temporal)));
     fclose($fp);
     unlink($origen);
     rename($destino, $origen);
     $image = new SimpleImage();
     $image->load($origen);
     if ($anchura > $altura) {
         $res = 1;
         $image->resizeToWidth($maxSize);
     } else {
         $res = 0;
         $image->resizeToHeight($maxSize);
     }
     $image->save($dest . $dirf . "/" . $imagenr);
     if (file_exists($dest . $dirf . "/" . $imagenr)) {
         unlink($origen);
     } else {
         $error = 'Imagen de marca de agua NO Encontrada';
     }
 } else {
     $error = 'Imagen Resized NO Encontrada';
 }
 if (file_exists($dest . $dirf . "/" . $imagent) && file_exists($dest . $dirf . "/" . $imagenr)) {
     //echo "Proceso exitoso.<br>";
     echo "insert into fotos (id_galeria,description,alto_ancho) " . "values(" . $gal . ",'" . $imagenr . "'," . $res . ");<br>";
     $b++;
 } else {
开发者ID:jorgea3004,项目名称:GeneraGaleria,代码行数:31,代码来源:index.php

示例12: upload

    function upload($userid, $max_byte_size = 2097152)
    {
        global $debug;
        global $config;
        $dir = 'media/avatar/';
        $msg = '';
        // upload button has been pressed
        if (@$_POST['submit'] == 'Upload') {
            // set allowed file types
            $allowed_types = "(jpg|jpeg|gif|bmp|png)";
            // is really a file?
            if (is_uploaded_file($_FILES["file"]["tmp_name"])) {
                // valid extension?
                if (preg_match("/\\." . $allowed_types . "\$/i", $_FILES["file"]["name"])) {
                    // file size okay?
                    if ($_FILES["file"]["size"] <= $max_byte_size) {
                        // width and height okay?
                        $size = getimagesize($_FILES['file']['tmp_name']);
                        $debug->add('img-size', 'height:' . $size[0] . ' width:' . $size[1]);
                        // get user
                        $u = $this->user->getUserByID($userid);
                        $filename = uniqid($u['userid'] . "_") . "_" . $_FILES["file"]["name"];
                        // everything all right, now copy
                        if (!file_exists($dir . $filename)) {
                            if (copy($_FILES["file"]["tmp_name"], $dir . $filename)) {
                                // Resize image if too large
                                $image = new SimpleImage();
                                $image->load($dir . $filename);
                                if ($image->getWidth() > (int) $config->get('core', 'img-width')) {
                                    $image->resizeToWidth((int) $config->get('core', 'img-width'));
                                }
                                if ($image->getHeight() > (int) $config->get('core', 'img-height')) {
                                    $image->resizeToHeight((int) $config->get('core', 'img-height'));
                                }
                                // Save image
                                $this->remove($filename);
                                $image->save($dir . $filename);
                                // upload successfull
                                $msg = $this->lang->get('upload_successfull');
                                // remove old avatar
                                $this->remove($u['avatar']);
                                // update avatar
                                $this->user->setAvatar($userid, $filename);
                            } else {
                                $msg = $this->lang->get('upload_failed');
                            }
                        } else {
                            $msg = $this->lang->get('upload_failed');
                        }
                    } else {
                        $msg = $this->lang->get('upload_too_large');
                    }
                } else {
                    $msg = $this->lang->get('upload_bad_extension');
                }
            } else {
                $msg = $this->lang->get('upload_failed');
            }
        }
        // display the upload-form
        return '
				<p>
					' . $msg . '
				</p>
				
				<form action="" method="post" enctype="multipart/form-data" name="upload">
					
					<input type="file" name="file" />
					<input type="submit" name="submit" value="Upload" />
					
				</form> 
				
				';
    }
开发者ID:tech-nik89,项目名称:lpm4,代码行数:74,代码来源:avatar.core.php

示例13: Upload

        }
    }
    if ($_FILES['image']['size'] > 0) {
        $upload = new Upload();
        $upload->dir = 'media/boximages/ad/';
        $upload->tag_name = 'image';
        $upload->uploadFile();
        $imgdir = "./media/boximages/ad/";
        include_once './core/simple.image.core.php';
        $image = new SimpleImage();
        $image->load($imgdir . $upload->file_name);
        if ($image->getWidth() > (int) $config->get('ad', 'standard_image_width')) {
            $image->resizeToWidth((int) $config->get('ad', 'standard_image_width'));
        }
        if ($image->getHeight() > (int) $config->get('ad', 'standard_image_height')) {
            $image->resizeToHeight((int) $config->get('ad', 'standard_image_height'));
        }
        unlink($imgdir . $upload->file_name);
        $image->save($imgdir . $upload->file_name);
        if (substr($_POST['newurl'], 0, 7) != "http://") {
            $_POST['newurl'] = "http://" . $_POST['newurl'];
        }
        $db->insert($tbl_ad, array('img', 'url'), array("'" . $upload->file_name . "'", "'" . $_POST['newurl'] . "'"));
    }
}
$allads = $db->selectList($tbl_ad, '*', 1);
$counter = 0;
$ads = array();
foreach ($allads as $ad) {
    $ads[$counter] = $ad;
    $ads[$counter++]['imgurl'] = makeUrl('ad', array('mode' => 'edit'));
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:ad.mod.php

示例14: date

 $r_date = date("d-m-Y");
 $uzanti = array('image/jpeg', 'image/jpg', 'image/png', 'image/x-png', 'image/gif');
 $dizin = "upload_images/" . uniqid('upload_images', true) . $_FILES['image_file']['name'];
 if (in_array(strtolower($_FILES['image_file']['type']), $uzanti)) {
     if ($_FILES['image_file']['size'] < "999999") {
         if (move_uploaded_file($_FILES['image_file']['tmp_name'], $dizin)) {
             $query = mysql_query("insert into lavazza_photoevent(fb_id,name,surname,email,phone,register_date,photo_url) values('{$fb_id}','{$name}','{$surname}','{$email}','{$phone}','{$r_date}','{$dizin}')");
             $image = new SimpleImage();
             $image->load($dizin);
             $image_width = $image->getWidth();
             $image_height = $image->getHeight();
             if ($image_width > 600 && $image_height > 600) {
                 $image->resize(600, 600);
             } else {
                 if ($image_height > 600) {
                     $image->resizeToHeight(600);
                 } else {
                     if ($image_width > 600) {
                         $image->resizeToWidth(600);
                     }
                 }
             }
             $image->save($dizin);
             echo "<meta http-equiv=\"refresh\" content=\"0; url=?go=success\">";
         }
     } else {
         echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?go=join_to_event&sk=error&type=size\">";
     }
 } else {
     echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?go=join_to_event&sk=error&type=file_type\">";
 }
开发者ID:ramazanrhino,项目名称:proje1,代码行数:31,代码来源:index1.php

示例15: processOrigLocal

 protected function processOrigLocal($localFile, $file)
 {
     if (file_exists($file)) {
         // error_log('Found file (1): ' . $relfile);
         DiscoUtils::debug('Using already cached file : ' . $file);
         return $file;
     }
     // if ($logo['height'] > 40) {
     $image = new SimpleImage();
     $image->load($localFile);
     $image->resizeToHeight(38);
     $image->save($file);
     if (file_exists($file)) {
         DiscoUtils::debug("Successfully resized logo and stored a new cached file.");
         return $file;
     }
     // }
     $orgimg = file_get_contents($localFile);
     file_put_contents($file, $orgimg);
     if (file_exists($file)) {
         DiscoUtils::debug('Using generated and cached file : ' . $file);
         return $file;
     }
 }
开发者ID:NIIF,项目名称:DiscoJuice-Backend,代码行数:24,代码来源:LogoCache.php


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