我正在尝试创建 CMS 照片库,需要在 upload.php 文件的末尾创建缩略图。我有一个名为 create_square_image 的函数,在“showphotos.php”页面上运行时可以正常工作。但是我不希望每次有人查看页面时都运行它。我尝试将以下内容添加到 SWFUpload...
// Process the file
/*
At this point we are ready to process the valid file. This sample code shows how to save the file. Other tasks
could be done such as creating an entry in a database or generating a thumbnail.
Depending on your server OS and needs you may need to set the Security Permissions on the file after it has
been saved.
*/
$thumb_save = "uploads/thumbs/thumb_" . $_FILES[$upload_name]["tmp_name"];
create_square_image($_FILES[$upload_name]["tmp_name"],$thumb_save,100);
if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path.$file_name)) {
HandleError("File could not be saved.");
exit(0);
}
exit(0);
create_square_image 函数使用这种格式: create_square_image ( string $filename , string $destination, size )
我已经尝试了几次,它会保存图像但不会保存缩略图。