Yii和Image上传YUSH

时间:2014-01-30 17:29:00

标签: php yii

我有一个问题,我根本不知道如何或事实上要解决什么。我正在使用Yii和一个名为YUSH的扩展。这有助于上传图像时的文件夹结构。

在我的本地主机上一切都很棒。但是现在我迁移到了实时服务器,文件名仍然被写入数据库,但是没有创建包含上传文件的文件夹。因此,只显示图像占位符。

这没有给出任何错误消息,所以我真的不知道如何修复它。我的主机在php.ini中增加了我的mem_size,我检查了所有错误日志。仍然没有。

这是我的代码:

$image = CUploadedFile::getInstance($l, 'path');
            if ($image)
            {
                // Clean up the filename
                $encName = md5($image->name . microtime()) . '.' . $image->extensionName;
                $l->path = $encName;
            }

        $l->merchant_id_fk = $this->getMerchantRelation(Yii::app()->user->id);

        switch ($l->validate()) {

                // User validate Successfull
                case TRUE:

                        if($l->save())
                        {

                            //Save Image
                            Yush::init($l);
                            // Nothing has been uploaded yet but YUSH will return a full path that can be used to save the resource
                            $originalPath = Yush::getPath($l, Yush::SIZE_ORIGINAL, $l->path);
                            // Save the original resource to disk
                            $image->saveAs($originalPath);
                            $thumbPath = Yush::getPath($l, Yush::SIZE_THUMB, $l->path);
                            // Create a thumbnail
                            // Kohana Image library
                            $thumbImage = Yii::app()->image->load($originalPath);
                            $thumbImage->resize(350, 350)->rotate(0)->quality(100)->sharpen(10);

                            // $thumbImage = PhpThumbFactory::create($originalPath);
                            // $thumbImage->resize(350, 350);

                            switch ($thumbImage->save($thumbPath)) {
                                case true:
                                    Yii::app()->user->setFlash('success', self::MESSAGE_SUCCESS);
                                    $this->redirect(Yii::app()->params->local . 'merchant/profile');
                                break;

                                default:
                                    # code...
                                    Yii::app()->user->setFlash('error', self::MESSAGE_FAILURE);
                                    $this->redirect(Yii::app()->params->local . 'merchant/profile');
                                break;
                            }

                        }
                        else
                        {
                            Yii::app()->user->setFlash('error', self::MESSAGE_FAILURE);
                            $this->redirect(Yii::app()->params->local . 'merchant/profile');
                        }
                break;
        }

有谁知道问题可能是什么?

0 个答案:

没有答案