要求:网站的后台上传图片时,能改动图片的位置和大小,大家谁有这样的代码啊?
发一段给我啊!!

解决方案 »

  1.   

    当然能啊
    给你个例子:
    /*public function uploadresultAction()
    {
    //处理头像上传

    ControllerHelper::disableCache();
    $this->_layout->disableLayout();
    $imgDir = DOCUMENT_ROOT . 'upload/images/.../';
    $adapter = new Zend_File_Transfer_Adapter_Http();
    $adapter->addValidator('Size', false, 200000)
    ->addValidator ('Extension', false, 'jpg,png,gif')
    ->addValidator('NotExists', false, $imgDir);
    list($type, $imgType) = explode('/', $adapter->getMimeType());
    $imgName = md5(time()) . ".$imgType";
    $adapter->addFilter('Rename', $imgDir . $imgName);

    if($adapter->receive ()) 
    {
    echo $imgName;
    }
    else
    {
    echo 0;
    }
    exit;
    }*/