易截截图软件、单文件、免安装、纯绿色、仅160KB

用php调整图片宽高

<?php
/**
* 改变图片的宽高
*
* @author flynetcn (2009-12-16)
*
* @param string $img_src 原图片的存放地址或url
* @param string $new_img_path 新图片的存放地址
* @param int $new_width 新图片的宽度
* @param int $new_height 新图片的高度
* @return bool 成功true, 失败false
*/
function resize_image($img_src, $new_img_path, $new_width, $new_height)
{
$img_info = @getimagesize($img_src);
if (!$img_info || $new_width < 1 || $new_height < 1 || empty($new_img_path)) {
return false;
}
if (strpos($img_info['mime'], 'jpeg') !== false) {
$pic_obj = imagecreatefromjpeg($img_src);
} else if (strpos($img_info['mime'], 'gif') !== false) {
$pic_obj = imagecreatefromgif($img_src);
} else if (strpos($img_info['mime'], 'png') !== false) {
$pic_obj = imagecreatefrompng($img_src);
} else {
return false;
}
$pic_width = imagesx($pic_obj);
$pic_height = imagesy($pic_obj);
if (function_exists("imagecopyresampled")) {
$new_img = imagecreatetruecolor($new_width,$new_height);
imagecopyresampled($new_img, $pic_obj, 0, 0, 0, 0, $new_width, $new_height, $pic_width, $pic_height);
} else {
$new_img = imagecreate($new_width, $new_height);
imagecopyresized($new_img, $pic_obj, 0, 0, 0, 0, $new_width, $new_height, $pic_width, $pic_height);
}
if (preg_match('~.([^.]+)$~', $new_img_path, $match)) {
$new_type = strtolower($match[1]);
switch ($new_type) {
case 'jpg':
imagejpeg($new_img, $new_img_path);
break;
case 'gif':
imagegif($new_img, $new_img_path);
break;
case 'png':
imagepng($new_img, $new_img_path);
break;
default:
imagejpeg($new_img, $new_img_path);
}
} else {
imagejpeg($new_img, $new_img_path);


相关文档:

PHP环境安装和配置


集成环境:WAMP...(W-windows,里面有Apache服务器、Mysql、Php和Mysql可视化工具SQLite)
Ps:安装过程会有提示,是否自启动,默认开发目录、默认浏览器,安装完成后会在右下角有个小表盘,因为默认安装完成后是英文版的,在小表盘上点右键-->language-->选择中文就行)
开发工具:easyeclipse
php...还不错的一个开 ......

PHP基本语法


标准代码如下:
<?php
...
?>
短标签模式(此模式需要修改PHP配置,让PHP支持短标签模式):
<?
...
?>
注释:
/* ...*/
//
#

其它:
在php中用";"来分隔语句。
例句:
<?php
echo "Hello World!"
?>
......

——php图像处理类

<?
* +-------------------------------------------------------------+
* | Copyright (c) 2008-2009 Diqiye.Com All rights reserved.
* +-------------------------------------------------------------+
* | Info : 图像处理类
* +------------------------------------------------------------ ......

PHP多用户在线客服系统

PHP多用户在线客服系统,后台有代码镶嵌到你的系统中,不过这个是英文的,感觉很实用,简洁,方便,需要的可以自己汉化,不就是改里面的一些提示信息嘛,地址是:http://mibew.org/
,这个是开源的,支持多用户同时在线联系客服,客服后台及时性很强,只要用户点击在线客服,后台就有提示,而且可以查看聊天记录,很多实用 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号