佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 953|回复: 2

imagecopyresampled()

[复制链接]
发表于 15-4-2008 10:37 PM | 显示全部楼层 |阅读模式
请问这个function 怎样用?
在 php.net 里的sample
<?php
// The file
$filename = 'test.jpg';
$percent = 0.5;

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;

// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// Output
imagejpeg($image_p, null, 100);
?>


我在localhost run 这个script, 没有东西出来。 (我的folder里有test.jpg)
回复

使用道具 举报


ADVERTISEMENT

发表于 16-4-2008 12:26 AM | 显示全部楼层
奇怪,我 copy and paste 你的code,然后再 copy 一个 test.jpg 在同一个 folder,run,可以show 照片出来哦。

你确定下你的 gd library 有没有 enable ? 在 php.ini 那边改的。
回复

使用道具 举报

 楼主| 发表于 16-4-2008 09:18 PM | 显示全部楼层
谢谢。。
其实php.net也有说 enable gd library。
一时没看见。
谢谢你的热情帮助!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 29-12-2025 06:18 AM , Processed in 0.108683 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表