加入收藏 | 设为首页 | 会员中心 | 我要投稿 汽车网 (https://www.0577qiche.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php在新浪云中采用imagick的方法

发布时间:2023-09-19 10:43:58 所属栏目:PHP教程 来源:
导读:php在新浪云中使用imagick生成缩略图并上传到Storage的方法

<?php
//缩略图
$tmpFile =&#39;http://Cuoxin.com/original.jpg&#39; ;

list($width, $height) = getimagesize($tmpFile);
php在新浪云中使用imagick生成缩略图并上传到Storage的方法

<?php 
//缩略图 
    $tmpFile ='http://Cuoxin.com/original.jpg' ; 
 
    list($width, $height) = getimagesize($tmpFile); 
     
    // resize if necessary 
    if ($width >= 550 && $height >= 550) { 
        $image = new Imagick($tmpFile); 
        $image->thumbnailImage(550, 550,true); 
    /* 上传文件到Storage */ 
    $st = new SaeStorage(); 
        $tmp_url = SAE_TMP_PATH.time();//保存到sae临时目录 
    file_put_contents($tmp_url,$image);     
    $path='/201608/22/1471856203_98548400.jpg'; 
        if (!$st->upload('upload', $path, $tmp_url)) {          
            echo 0; 
        } else { 
            echo $st->getUrl('upload', $path); 
        }//Cuoxin.com 
    } 
?> 
 

(编辑:汽车网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章