Home  >  Article  >  php教程  >  keditor_php image upload

keditor_php image upload

WBOY
WBOYOriginal
2016-08-30 09:21:141397browse

 
 
 
 
 
 

html:


                            
                          

                                (分页符为:
                                #p#分页-标题#e#)
                                
                                
                                (
                                [取消缩略图]
                                )
                                

                            *
                            
必填项,可无限输入,没有字数限制.

                             
                        

                        

//Backend code

//Keditor editor upload image processing
Public function ke_upimg(){
/* Return standard data*/
$return = array('error' => 0, 'info' => 'Upload successful', ' data '= & gt;' ');
$ img = $ this-& gt; upload ();
/* record attachment information*/
IF ($ img) {
$ return [' url '] = $ img [' fullpath'];
                                                                                                                                                                                                                    fullpath']; 'Upload_error');
}
/* Back json data*/
exit (json_encode ($ Return)); upload_error ' ); 'maxSize' => 3145728,
'savePath' => './news/',
'saveName' => array('uniqid',''),
'exts' => array('jpg', 'gif', 'png' , 'jpeg'),
'autoSub' => true,
' 'subName' => array('date','Ymd'),
' );
' $this->uploader = new ThinkUpload($config, 'Local');
$info = $this->uploader->upload($_FILES);
//Log::write(print_r($info));
if($info){
$url = '/Uploads'.$info['imgFile']['savepath'].$info['imgFile']['savename'];
                     $url = str_replace('./', '/', $url);
            $info['fullpath'] = __ROOT__.$url;
                                                                                                                                                                         Return $info;
}

/* *
   * Upload pictures
 */
public function uploadpicTure () {
// TODO: User login detection
Back to standard data*/
$ Return = Array ('Status' = & GT; 1, 'Info' = & GT; ' Uploaded successfully', 'data' => '');
                     'saveName' => ; array('uniqid',''),
'exts' => array('jpg', 'gif', 'png', 'jpeg'),
'autoSub' => true,
'subName' => array('date','Ymd'),
);
$this->uploader = new ThinkUpload($config, 'Local');
$info = $this->uploader->upload ($_FILES);

                                                                                                                                                                                           $ Url = str_replace ('./', '/', $ url);
$ Return ['PATH'] = __ROOT __. $ Url;
$ Return ['ID'] = 111; '] = 1;
              $return = array_merge($info['download'] ,                                                                                                                                                                                 . >uploader->getError();


js script, extract the first picture:

//Get the first picture
$('#autolitpic').click(function (){
if($(this).attr('checked')){
$(this).attr('checked' ,false);
}else {
                                                                                                                                                                            $(this).attr('checked',true); [^"]+"/g)==null){
                                                                                                                                                                                                                                                             ‐ ’‐ ‐ ‐ ‐ ending out ts. /g)[0].replace("src="","");
     var val=strcount.substring(0,strcount.length-1).replace("http://cb2013.tdedu.org", "");

                                                                       .

//Cancel contraction Thumbnail

$('.qximg').click(function (){

$("#thumb_img").attr('src',"");

$("#img").val("");

});





Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn