0

我正在尝试创建 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 )

我已经尝试了几次,它会保存图像但不会保存缩略图。

4

1 回答 1

0

将权限设置/uploads/thumbs/为 777。您还可以尝试指定该位置的绝对路径。要查看您的绝对路径,请使用以下代码:echo getcwd();

于 2012-02-12T21:57:47.243 回答