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