freefish_yoyo
- freefish_yoyo 回复了话题 关于Cthumb
解决啦,谢谢各位
- freefish_yoyo 回复了话题 关于Cthumb
action 代码
public function actionCreate() { $save_path='upload/'; $resize_array=array( 'mw'=>100, 'mh'=>100, ); $model=new User(); if(isset($_POST['User'])) { $model->attributes=$_POST['User']; $upload_image=CUploadedFile::getInstance($model,'photo'); if(is_object($upload_image) && get_class($upload_image)==='CUploadedFile') { $ext=$upload_image->extensionName;//上传文件的扩展名 $filename=time().'.'.$ext; $time_path=date('Ymd',time()).'/'; if(is_dir($save_path.$time_path)) { $dir=$save_path.$time_path; } else { $dir=mkdir($save_path.$time_path); } $save_path=$dir; $imgurl=$save_path.$filename;//上传文件保存路径 $model->photo=$imgurl; if($model->save()) { $upload_image->saveAs($imgurl); } $im=NULL; $imagetype=strtolower($ext); { if($imagetype=='gif') { $im=imagecreatefromgif($imgurl); } elseif($imagetype=='jpg') { $im=imagecreatefromjpeg($imgurl); } elseif($imagetype=='png') { $im=imagecreatefrompng($imgurl); } } foreach($resize_array as $k=>$v) { $mw=$v['mw']; $mh=$v['mh']; $thumb_file_name=$save_path.$k.'_'.$filename; } CThumb::resizeImage($im,$mw,$mh,$thumb_file_name,$ext); } } $this->render('create',array('model'=>$model)); }
- freefish_yoyo 回复了话题 关于Cthumb
论坛终于好了。嗯。是有photo这个属性的。这个问题已经解决了,不过又出现了一个问题,就是生成缩略图的时候,缩略图的后缀名有问题,变成了像下面的样子“mh_1348720692.gifgif”,不知道是怎么回事
- freefish_yoyo 发布了话题关于Cthumb
- freefish_yoyo 回复了话题 yii超牛X的调试工具
呵呵。。。很好用,谢谢分享
好像和舰长的视屏讲是一样的,不过还是很好,good
舰长发的东西有保证,下了再说
- freefish_yoyo 回复了话题 Yii的ajax分页
额,思路大致了解了,但是看不太明白
舰长加油,希望能够在出视屏教程
支持舰长,希望能出关于Yii更多的视屏,期待,哇咔咔