webyjh
- webyjh 发布了话题如何精简yii框架?:)
- webyjh 回复了话题 上传文件,验证出错,不能为空?
目前只能禁用了ajax验证
- webyjh 发布了话题上传文件,验证出错,不能为空?
感谢奇遇和舰长,辛苦了
上传之前一定要先验证一下
array('front_img','file','types'=>'jpg,gif,png','allowEmpty'=>true),
添加allowEmpty,还有先插入数据库再上传,这样验证才正常
- webyjh 回复了话题 关于缩略图扩展cthumb的问题
原来扩展里有这一句,应该是多余了
//$name = $name . $filetype;//这句好像多余了
<?php class CThumb extends CApplicationComponent { public static function resizeImage($im, $maxwidth, $maxheight, $name,$filetype) { $pic_width = imagesx ( $im ); $pic_height = imagesy ( $im ); if (($maxwidth && $pic_width > $maxwidth) || ($maxheight && $pic_height > $maxheight)) { if ($maxwidth && $pic_width > $maxwidth) { $widthratio = $maxwidth / $pic_width; $resizewidth_tag = true; } if ($maxheight && $pic_height > $maxheight) { $heightratio = $maxheight / $pic_height; $resizeheight_tag = true; } if ($resizewidth_tag && $resizeheight_tag) { if ($widthratio < $heightratio) $ratio = $widthratio; else $ratio = $heightratio; } if ($resizewidth_tag && ! $resizeheight_tag) $ratio = $widthratio; if ($resizeheight_tag && ! $resizewidth_tag) $ratio = $heightratio; $newwidth = $pic_width * $ratio; $newheight = $pic_height * $ratio; if (function_exists ( "imagecopyresampled" )) { $newim = imagecreatetruecolor ( $newwidth, $newheight ); imagecopyresampled ( $newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $pic_width, $pic_height ); } else { $newim = imagecreate ( $newwidth, $newheight ); imagecopyresized ( $newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $pic_width, $pic_height ); } imagejpeg ( $newim, $name ); imagedestroy ( $newim ); } else { //$name = $name . $filetype;//这句好像多余了 imagejpeg ( $im, $name ); } } } ?>
- webyjh 发布了话题关于缩略图扩展cthumb的问题
- webyjh 回复了话题 [已解决]提示找不到扩展
晕啊,我把components看成extensions,还以为引入了,嘿嘿,
还是舰长V5