0
所以我有一個PHP文件,上傳圖像到我的服務器。上傳後,我想將圖像大小調整爲100X100文件。下面是我的代碼不起作用。
請幫忙!
<?php
include 'resize.image.class.php';
$get_username = "usernamehere";
$new_id = "19";
$uploadDir = "./../users/$get_username/pictures/";
$file = basename($_FILES['userfile']['name']);
$uploadFile = $file;
$newName = $uploadDir . $new_id . $uploadFile;
$file_size = $_FILES['userfile']['size'];
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
$image = new Resize_Image;
$image->new_width = 100;
$image->new_height = 100;
$image->image_to_resize = "./../users/$get_username/pictures/$new_id.jpg"; // Full Path to the file
$image->ratio = true;
$image->new_image_name = "$new_id";
$image->save_folder = "./../users/$get_username/pictures/thumbnails/";
$process = $image->resize();
}
?>
這是一個簡化版本。但是,當我單獨運行調整大小的代碼時,代碼工作。思考?
再次感謝!
有什麼錯誤?什麼是resize.image.class.php? – Jacob 2011-02-17 05:55:00
唯一的錯誤:該文件不存在。 – iosfreak 2011-02-17 05:56:22