javascript - 在 jquery codeigniter 中上传图像后进行编辑

标签 javascript php jquery codeigniter

我想在上传后编辑图像旋转。这是我的 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/

相关文章:

php - 使用 PHP 从 .pdf 中提取页面

jquery - 使用 Jquery Json P 将外部数据加载到phonegap中

jquery - 设置 jstree 时要包含哪些 .js 和 .css 文件

javascript - 如何使 ng-repeat 与返回新对象的函数一起工作?

javascript - getusermedia DevicesNotFoundError 在最新的浏览器中抛出

php - TCPDF 页面边框?

javascript - 为什么ajax请求不触发验证

javascript - 使用 Material-ui 传递数据以显示表信息时出错

javascript - 为什么我可以在不修改架构的情况下将自定义元素插入ckeditor

php - select union 不汇总选择