1
我可以上傳圖片並用phpthumb調整大小,但我怎樣才能也上傳原始圖片?phpthumb zend框架
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
// upload the image
if ($form->station_image->isUploaded()) {
$form->station_image->receive();
$station_image = '/upload/images/radio/' . basename($form->station_image->getFileName());
//upload thumb
include_once '../library/PhpThumb/ThumbLib.inc.php';
$thumb = PhpThumbFactory::create($form->station_image->getFileName());
$thumb->resize(50, 50)->save($form->station_image->getFileName());
//thumb ends
}else{
echo 'cannot upload'. exit;
}
我的形式看起來像這樣
$station_image->setLabel('Upload File: ')
->setDestination(APPLICATION_PATH.'/../public/upload/images/radio')
->addValidator('Extension', false, 'jpg,png,gif')
->addValidator('Size', false, 902400)
->addValidator('Count', false, 1)
->setRequired(false);
請幫助我如何上傳多個縮略圖,或者我怎樣才能上傳以及原始文件?由於
謝謝,但我怎麼設置相對路徑保存縮略圖?請幫助 – ktm 2012-04-18 09:17:37
更新瞭解決方案。 – 2012-04-18 16:43:13
它用來覆蓋原始圖像之前,現在它甚至不創建縮略圖。我想知道如果在窗體中設置目標是造成問題。 – ktm 2012-04-19 02:14:13