我在multyupload上调整图像数组大小时遇到问题。
通常情况下,我使用简单的图像大小调整器为一个单一的图像,但我不能调整一组项目使用数组...我哪里出错了?
<?php
session_start();
$serverpath = "C:\EasyPHP-12.1\www\www.arcasarda.pet\\";
$uploaddir = $serverpath."img/pagine/";
if(count($_FILES) > 0) {
$id=$_POST['id'];
$arrfile = pos($_FILES);
$file = $id.'_'.stripslashes(basename($arrfile['name']));
$uploadfile = $uploaddir . $file;
if (move_uploaded_file($arrfile['tmp_name'], $uploadfile)) {
$img_path = $uploadfile;
$size = @getimagesize ($img_path);
if ($size[0] > $size[1]) {
resize_larghezzafissa ($img_path,1500);
} else {
resize_altezzafissa ($img_path,1500);
}
chmod($uploadfile, 0777);
include $serverpath."/db_connection.php";
$query = "SELECT MAX(ordine) FROM testi_img WHERE id_testo='$id'";
$result=mysql_query($query);
list($max)=mysql_fetch_row($result);
$ordine=$max+1;
$query="SET SESSION sql_mode=''";
mysql_query($query);
$query = "INSERT INTO testi_img (id_testo, img, dida, ordine) VALUES ('$id', '$file', '{italiano}{/italiano}', '$ordine')";
mysql_query($query);
}
}
下面是与SimpleImageResizer类一起使用的函数
function resize_larghezzafissa($src, $witdh){
include($serverpath.'/php/SimpleImage.php');
$image = new SimpleImage();
$image->load($src);
$image->resizeToWidth($witdh);
$image->save($src, IMAGETYPE_JPEG, 100, null);
}
function resize_altezzafissa($src, $height){
include($serverpath.'/php/SimpleImage.php');
$image = new SimpleImage();
$image->load($src);
$image->resizeToHeight($height);
$image->save($src, IMAGETYPE_JPEG, 100, null);
}
?>
1条答案
按热度按时间ie3xauqp1#
PS:对于单个文件,我使用此脚本,其工作原理: