Symfony2,压缩图像文件

时间:2014-06-04 09:45:41

标签: symfony upload

所以,我有一个在我的服务器上上传图像的动作,如:

            if( ( $file = $request->files->get('file')) !== null) {
                $date = new \DateTime();
                $fileName = $this->getUser()->getId() . '_' . $date->getTimestamp();
                $file->move('uploads', $fileName);
            }

我需要,在move()之前,压缩我的图像以减小尺寸。 Symfony2有什么东西吗?

我怎么能这么做呢?

1 个答案:

答案 0 :(得分:0)

您在Google上搜索过了吗? https://github.com/liip/LiipImagineBundle可以解决问题!