php - jQuery resizable on image -
i have site develop in codeigniter, , want upload image ajax , make resizable. i'm able upload , show image isn't resizable.
this upload script:
public function ajaximage(){ $path = "uploads/tee/element/"; $session_id = $this->session->userdata('id'); $valid_formats = array("jpg", "png", "gif", "bmp","jpeg"); if(isset($_post) , $_server['request_method'] == "post") { $name = $_files['upload']['name']; $size = $_files['upload']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) // image size max 1 mb { $actual_image_name = time().$session_id.".".$ext; $tmp = $_files['upload']['tmp_name']; if(move_uploaded_file($tmp, $path.$actual_image_name)) { echo "<img src='".base_url().$path.$actual_image_name."' class='resizable' width='200px' height='100px'>"; } else echo "failed"; } else echo "image file size max 1 mb"; } else echo "invalid file format.."; } else echo "please select image..!"; exit; } }
this ajax function handles request. have put image inside div
, , image must resizable:
<script> $(document).ready(function(){ $(".resizable").resizable(); function showresponse(responsetext){ $(responsetext).appendto("#space-drawable-div").resizable(); $(responsetext).css('position','absolute').css('top','0px').css('left','0px').css('z-index','5'); } $('#upload-form').ajaxform(showresponse); }); </script>
the image shown, can't resize it.
there's no error shown in console.
Comments
Post a Comment