2012-02-12 146 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();