欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php缩放图片_PHP教程

程序员文章站 2022-06-01 21:28:21
...
使用方法:


设定宽高,不等比例缩放
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resize(250,400);
$image->save('picture2.jpg');?>设定宽度,等比例缩放 include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(250);
$image->save('picture2.jpg');?>设定高度,等比例缩放 include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToHeight(500);
$image->save('picture2.jpg');
$image->resizeToHeight(200);
$image->save('picture3.jpg');?>按比例,缩放至50% include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->scale(50);
$image->save('picture2.jpg');?>缩放后直接输出到屏幕 header('Content-Type: image/jpeg');
include('SimpleImage.php');
$image = new SimpleImage();
$image->load('picture.jpg');
$image->resizeToWidth(150);
$image->output();?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477328.htmlTechArticle使用方法: 设定宽高,不等比例缩放 ?php include(SimpleImage.php); $image = new SimpleImage(); $image-load(picture.jpg); $image-resize(250,400); $image-save(picture2....