我想在上传后编辑图像旋转。这是我的 jquery 代码。我成功旋转了图像,但虽然我想保存它但什么也不做。
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"/>
这是我的 codeigniter 代码。
$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();
}
请帮帮我。
最佳答案
我认为他们一定是你的rotation_angle值有问题 echo $this->input->post('rotate_val');并 prin_r 你的 $config
最重要的是您使用错误的条件来回显错误,只需添加! if 中的运算符像这样
if(!$this->image_lib->resize())
关于javascript - 在 jquery codeigniter 中上传图像后进行编辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44225235/