2017-05-28 25 views
1

我想在upload.jsp上傳後編輯圖像旋轉。這裏是我的jQuery代碼。我旋轉圖像成功,但我想保存它什麼都不做。在jquery codeigniter中上傳圖像後編輯

var value = 0 
$("#change_image_rotate").rotate({ 
    bind: 
    { 
     click: function(){ 
      value +=90; 
      $(this).rotate({ animateTo:value}) 
      $('#rotate_val').val(value); 
     } 
    } 

}); 
function editImage(img_src){ 
$('#change_image_rotate').attr("src","<?php echo base_url();?>bric_gallery/"+img_src); 
$('#img_val_rotate').val(img_src); 
} 

This is the image of my portal

這是我的HTML部分,在那裏我得到的旋轉價值和形象的名字。

<form action="<?php echo base_url();?>admin/gallery/rotate_image" method="post"> 
    <input type="hidden" id="img_val_rotate" name="img_val_rotate"/> 
    <input type="hidden" id="rotate_val" name="rotate_val"/> 

,這是我笨的代碼。

$config['image_library'] = 'gd2'; 
       $config['source_image'] = './bric_gallery/'.$this->input->post('img_val_rotate'); //get original image 
       $config['maintain_ratio'] = TRUE; 
       $config['rotation_angle'] = $this->input->post('rotate_val');//counter-clockwise angle of rotation 
       $this->load->library('image_lib', $config); 
       if ($this->image_lib->rotate()) { 
        echo $this->image_lib->display_errors(); 
       } 

請幫我一把。

回答

0

我認爲他們必須在你的旋轉角度值的問題echo $ this-> input-> post('rotate_val');和prin_r你的$配置

和最重要的是你使用錯誤的條件來回顯錯誤只是添加!操作者在如果這樣

+0

的print_r返回陣列([image_library] => GD2 [source_image] => ./bric_gallery/IMG_2030.JPG [maintain_ratio] => 1 [rotation_angle] => 90) –

+0

i設定爲改變你告訴過。但注意到會發生。 –

+0

你是否試圖改變如果條件與if(!$ this-> image_lib-> resize())並檢查您的目錄和文件是否受到影響 –