2012-02-12 79 views
0

我正在嘗試CMS照片庫並需要在我的upload.php文件末尾創建縮略圖。我有一個名爲create_square_image的函數,可以在'showphotos.php'頁面上運行時正常工作。但是,我不希望每次有人查看該頁面時都會運行它。我曾嘗試加入以下SWFUpload的...使用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 ([email protected]_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(字符串$文件名,字符串$目的地,大小)

我已經嘗試過幾次,它會保存圖像而不是縮略圖。

回答

0

/uploads/thumbs/的權限設置爲777.您還可以嘗試指定該位置的絕對路徑。要查看您的絕對路徑,請使用此代碼:echo getcwd();