{"id":1566,"date":"2017-06-02T13:25:30","date_gmt":"2017-06-02T07:55:30","guid":{"rendered":"https:\/\/blog.pheonixsolutions.com\/?p=1566"},"modified":"2017-11-08T21:01:09","modified_gmt":"2017-11-08T15:31:09","slug":"codeigniter-image-upload-crop-resize","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/","title":{"rendered":"CodeIgniter Image Upload and Crop,resize"},"content":{"rendered":"<p><code><\/code><\/p>\n<p style=\"text-align: left;\"><strong>Date Posted:02-06-2017<\/strong><\/p>\n<p>In this post We will explain image upload with crop,resize in codeigniter using jquery plugin<br \/>\nI assume that you are\u00a0 configure or setup the codeigniter<\/p>\n<p>step 1:<br \/>\nDownload the jquery.min.js and jquery.Jcrop.min.js,Jcrop.css files and link to script or use cdn link.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;source type=\"text\/javascript\"\u00a0 src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.1\/jquery.min.js\"&gt;&lt;\/source&gt;\r\n\u00a0&lt;link rel=\"stylesheet\" href=\"http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/css\/jquery.Jcrop.css\" type=\"text\/css\" \/&gt;\r\n\u00a0&lt;source type=\"text\/javascript\" src=\"http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/js\/jquery.Jcrop.js\"&gt;&lt;\/source&gt;\r\n\r\n\r\n<\/pre>\n<p>Step 2: Create new js file inside assets folder and give name script.js and the following code.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/\/ convert bytes into friendly format\r\nfunction bytesToSize(bytes) {\r\n    var sizes = ['Bytes', 'KB', 'MB'];\r\n    if (bytes == 0) return 'n\/a';\r\n    var i = parseInt(Math.floor(Math.log(bytes) \/ Math.log(1024)));\r\n    return (bytes \/ Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];\r\n};\r\n\r\n\/\/ check for selected crop region\r\nfunction checkForm() {\r\n    if (parseInt($('#w').val())) return true;\r\n    $('.error').html('Please select a crop region and then press Upload').show();\r\n    return false;\r\n};\r\n\r\n\/\/ update info by cropping (onChange and onSelect events handler)\r\nfunction updateInfo(e) {\r\n    $('#x1').val(e.x);\r\n    $('#y1').val(e.y);\r\n    $('#x2').val(e.x2);\r\n    $('#y2').val(e.y2);\r\n    $('#w').val(e.w);\r\n    $('#h').val(e.h);\r\n};\r\n\r\n\/\/ clear info by cropping (onRelease event handler)\r\nfunction clearInfo() {\r\n    $('.info #w').val('');\r\n    $('.info #h').val('');\r\n};\r\n\r\n\/\/ Create variables (in this scope) to hold the Jcrop API and image size\r\nvar jcrop_api, boundx, boundy;\r\n\r\nfunction fileSelectHandler() {\r\n\r\n    \/\/ get selected file\r\n    var oFile = $('#image_file')[0].files[0];\r\n\r\n    \/\/ hide all errors\r\n    $('.error').hide();\r\n\r\n    \/\/ check for image type (jpg and png are allowed)\r\n    var rFilter = \/^(image\\\/jpeg|image\\\/png)$\/i;\r\n    if (! rFilter.test(oFile.type)) {\r\n        $('.error').html('Please select a valid image file (jpg and png are allowed)').show();\r\n        return;\r\n    }\r\n\r\n    \/\/ check for file size\r\n    if (oFile.size &gt; 250 * 1024) {\r\n        $('.error').html('You have selected too big file, please select a one smaller image file').show();\r\n        return;\r\n    }\r\n    if (oFile.size &lt; 300 * 300) {\r\n        $('.error').html('You have selected too small file, please select a one bigger image file').show();\r\n        return;\r\n    }\r\n\r\n    \/\/ preview element\r\n    var oImage = document.getElementById('preview');\r\n\r\n    \/\/ prepare HTML5 FileReader\r\n    var oReader = new FileReader();\r\n        oReader.onload = function(e) {\r\n\r\n        \/\/ e.target.result contains the DataURL which we can use as a source of the image\r\n        oImage.src = e.target.result;\r\n        oImage.onload = function () { \/\/ onload event handler\r\n\r\n            \/\/ display step 2\r\n            $('.step2').fadeIn(500);\r\n\r\n            \/\/ display some basic image info\r\n            var sResultFileSize = bytesToSize(oFile.size);\r\n            $('#filesize').val(sResultFileSize);\r\n            $('#filetype').val(oFile.type);\r\n            $('#filedim').val(oImage.naturalWidth + ' x ' + oImage.naturalHeight);\r\n\r\n            \/\/ destroy Jcrop if it is existed\r\n            if (typeof jcrop_api != 'undefined') {\r\n                jcrop_api.destroy();\r\n                jcrop_api = null;\r\n                $('#preview').width(oImage.naturalWidth);\r\n                $('#preview').height(oImage.naturalHeight);\r\n            }\r\n\r\n            setTimeout(function(){\r\n                \/\/ initialize Jcrop\r\n                $('#preview').Jcrop({\r\n                    minSize: [32, 32], \/\/ min crop size\r\n                    aspectRatio : 1, \/\/ keep aspect ratio 1:1\r\n                    bgFade: true, \/\/ use fade effect\r\n                    bgOpacity: .3, \/\/ fade opacity\r\n                    onChange: updateInfo,\r\n                    onSelect: updateInfo,\r\n                    onRelease: clearInfo\r\n                }, function(){\r\n\r\n                    \/\/ use the Jcrop API to get the real image size\r\n                    var bounds = this.getBounds();\r\n                    boundx = bounds[0];\r\n                    boundy = bounds[1];\r\n\r\n                    \/\/ Store the Jcrop API in the jcrop_api variable\r\n                    jcrop_api = this;\r\n                });\r\n            },3000);\r\n\r\n        };\r\n    };\r\n\r\n    \/\/ read selected file as DataURL\r\n    oReader.readAsDataURL(oFile);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Step 3: CI app&#8217;s application\/views folder and lets create a view file named crop_view.php. and add the script following script code<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">            $(function(){\r\n \r\n                $('#cropbox').Jcrop({\r\n                    aspectRatio: 1,\r\n                    onSelect: updateCoords\r\n                });\r\n \r\n            });\r\n \r\n            function updateCoords(c)\r\n            {\r\n                $('#x').val(c.x);\r\n                $('#y').val(c.y);\r\n                $('#w').val(c.w);\r\n                $('#h').val(c.h);\r\n            };\r\n \r\n            function checkCoords()\r\n            {\r\n                if (parseInt($('#w').val())) return true;\r\n                alert('Select where you want to Crop.');\r\n                return false;\r\n            };\r\n \r\n<\/pre>\n<p>Step 4: After\u00a0 crop_view.php inside div add following code and also link the script.js(Refer step2)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">  &lt;?php $this-&gt;load-&gt;helper('url');\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;title&gt;Crop Image&lt;\/title&gt;\r\n         &lt;source type=\"text\/javascript\" src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.1\/jquery.min.js\"&gt;&lt;\/source&gt;\r\n\r\n   \r\n&lt;link rel=\"stylesheet\" href=\"http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/css\/jquery.Jcrop.css\" type=\"text\/css\" \/&gt;\r\n&lt;source type=\"text\/javascript\" src=\"http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/js\/jquery.Jcrop.js\"&gt;&lt;\/source&gt;\r\n&lt;source type=\"text\/javascript\" src=\"&lt;?=base_url().'assets\/script.js'?&gt;\"&gt;&lt;\/source&gt;\r\n\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form action=\"site_url('crop\/cropImg)?&gt; method=\"post\" onSubmit=\"return checkForm()\" entype=\"multipart\/form-data\"&gt;\r\n\u00a0\u00a0\u00a0 &lt;input type=\"hidden\" id=\"x1\" name=\"x1\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;input type=\"hidden\" id=\"y1\" name=\"y1\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;input type=\"hidden\" id=\"x2\" name=\"x2\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;input type=\"hidden\" id=\"y2\" name=\"y2\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;input type=\"file\" name=\"image_file\" class=\"loginlink image_class\" id=\"image_file\" onChange=\"fileSelectHandler()\"\/&gt; \r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;img id=\"preview\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;label class=\"info1\"&gt;File size&lt;\/label&gt; &lt;input type=\"text\" class=\"info1\" id=\"filesize\" name=\"filesize\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;label class=\"info1\"&gt;Type&lt;\/label&gt; &lt;input type=\"text\"\u00a0 class=\"info1\" id=\"filetype\" name=\"filetype\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;label class=\"info1\"&gt;Image dimension&lt;\/label&gt; &lt;input type=\"text\"\u00a0 class=\"info1\" id=\"filedim\" name=\"filedim\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;label class=\"info1\"&gt;W&lt;\/label&gt; &lt;input type=\"text\" class=\"info1\" id=\"w\" name=\"w\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;label class=\"info1\"&gt;H&lt;\/label&gt; &lt;input type=\"text\" class=\"info1\" id=\"h\" name=\"h\" \/&gt;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0&lt;input\u00a0 type=\"submit\" class=\"img-upload\" value=\"Upload\"\/&gt;\r\n&lt;\/form&gt;\r\n&lt;body&gt;<\/pre>\n<div id=\"outer\"><\/div>\n<p>Step 5: Navigate to your controllers folder and create a file named crop.php and add the following code to it<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\r\ndefined('BASEPATH') OR exit('No direct script access allowed');\r\n\r\nclass Crop extends CI_Controller {\r\n\r\n  \/**\r\n   * Index Page for this controller.\r\n   *\r\n   * Maps to the following URL\r\n   * \t\thttp:\/\/example.com\/index.php\/welcome\r\n   *\t- or -\r\n   * \t\thttp:\/\/example.com\/index.php\/welcome\/index\r\n   *\t- or -\r\n   * Since this controller is set as the default controller in\r\n   * config\/routes.php, it's displayed at http:\/\/example.com\/\r\n   *\r\n   * So any other public methods not prefixed with an underscore will\r\n   * map to \/index.php\/welcome\/&lt;method_name&gt;\r\n   * @see https:\/\/codeigniter.com\/user_guide\/general\/urls.html\r\n   *\/\r\n  public function index()\r\n  {\r\n    $this-&gt;load-&gt;view('crop_view');\r\n  }\r\n  public function cropImg()\r\n  {\r\n    if ($_FILES) \r\n       {\r\n        \t$config['upload_path']   = '.\/assets\/'; \r\n      $config['allowed_types'] = '*';\t\t\r\n      $config['encrypt_name']= true;\r\n\r\n      $this-&gt;load-&gt;library('upload', $config);\r\n      if (!is_dir($config['upload_path'])) {\r\n      mkdir($config['upload_path'], 0777, TRUE);\r\n      }\t\r\n      if ( ! $this-&gt;upload-&gt;do_upload('image_file')) {\r\n      $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());           \r\n      }\r\n      else\r\n      { \r\n        \/\/ $width=200;\r\n        \/\/ $height=200;\r\n        $up_file_data = $this-&gt;upload-&gt;data();\r\n        $config['image_library'] = 'gd2';\r\n            $config['source_image'] = $config['upload_path'].'\/'.$up_file_data['file_name'];\r\n            $config['x_axis'] = $this-&gt;input-&gt;post('x1');\r\n            $config['y_axis'] = $this-&gt;input-&gt;post('y1');\r\n            $config['maintain_ratio'] = FALSE;\r\n            $config['width'] = $this-&gt;input-&gt;post('w');\r\n            $config['height'] = $this-&gt;input-&gt;post('h');\r\n            $config['quality'] = '90%';\r\n            $this-&gt;load-&gt;library('image_lib', $config);\r\n            $this-&gt;image_lib-&gt;crop();\r\n           \r\n      } \r\n         } \r\n \r\n  }\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Date Posted:02-06-2017 In this post We will explain image upload with crop,resize in codeigniter using jquery plugin I assume that you are\u00a0 configure or setup the codeigniter step 1: Download the jquery.min.js and jquery.Jcrop.min.js,Jcrop.css files and link to script or use cdn link. &lt;source type=&#8221;text\/javascript&#8221;\u00a0 src=&#8221;http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.1\/jquery.min.js&#8221;&gt;&lt;\/source&gt; \u00a0&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/css\/jquery.Jcrop.css&#8221; type=&#8221;text\/css&#8221;&hellip; <a href=\"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">CodeIgniter Image Upload and Crop,resize<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[340,221],"tags":[341,273],"class_list":{"0":"post-1566","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-codeigniter","7":"category-php","8":"tag-codeigniter","9":"tag-php","10":"h-entry","12":"h-as-article"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pheonix Solutions - We Empower Your Business Growth<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pheonix Solutions - We Empower Your Business Growth\" \/>\n<meta property=\"og:description\" content=\"Date Posted:02-06-2017 In this post We will explain image upload with crop,resize in codeigniter using jquery plugin I assume that you are\u00a0 configure or setup the codeigniter step 1: Download the jquery.min.js and jquery.Jcrop.min.js,Jcrop.css files and link to script or use cdn link. &lt;source type=&quot;text\/javascript&quot;\u00a0 src=&quot;http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.1\/jquery.min.js&quot;&gt;&lt;\/source&gt; \u00a0&lt;link rel=&quot;stylesheet&quot; href=&quot;http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/css\/jquery.Jcrop.css&quot; type=&quot;text\/css&quot;&hellip; Continue Reading CodeIgniter Image Upload and Crop,resize\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/\" \/>\n<meta property=\"og:site_name\" content=\"PHEONIXSOLUTIONS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-02T07:55:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-08T15:31:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"3837\" \/>\n\t<meta property=\"og:image:height\" content=\"2540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:site\" content=\"@pheonixsolution\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\"},\"headline\":\"CodeIgniter Image Upload and Crop,resize\",\"datePublished\":\"2017-06-02T07:55:30+00:00\",\"dateModified\":\"2017-11-08T15:31:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/\"},\"wordCount\":138,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"keywords\":[\"codeigniter\",\"php\"],\"articleSection\":[\"Codeigniter\",\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/\",\"name\":\"Pheonix Solutions - We Empower Your Business Growth\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-06-02T07:55:30+00:00\",\"dateModified\":\"2017-11-08T15:31:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/codeigniter-image-upload-crop-resize\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CodeIgniter Image Upload and Crop,resize\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"name\":\"Pheonix Solutions\",\"description\":\"We Empower Your Business Growth\",\"publisher\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#organization\",\"name\":\"PheonixSolutions\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"contentUrl\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/logo.png\",\"width\":454,\"height\":300,\"caption\":\"PheonixSolutions\"},\"image\":{\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/PheonixSolutions-209942982759387\\\/\",\"https:\\\/\\\/x.com\\\/pheonixsolution\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/0ffa33d73c869faec2d50e79c24e3503\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\\\/\\\/blog.pheonixsolutions.com\"],\"url\":\"https:\\\/\\\/pheonixsolutions.com\\\/blog\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pheonix Solutions - We Empower Your Business Growth","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/","og_locale":"en_US","og_type":"article","og_title":"Pheonix Solutions - We Empower Your Business Growth","og_description":"Date Posted:02-06-2017 In this post We will explain image upload with crop,resize in codeigniter using jquery plugin I assume that you are\u00a0 configure or setup the codeigniter step 1: Download the jquery.min.js and jquery.Jcrop.min.js,Jcrop.css files and link to script or use cdn link. &lt;source type=\"text\/javascript\"\u00a0 src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.1\/jquery.min.js\"&gt;&lt;\/source&gt; \u00a0&lt;link rel=\"stylesheet\" href=\"http:\/\/jcrop-cdn.tapmodo.com\/v0.9.12\/css\/jquery.Jcrop.css\" type=\"text\/css\"&hellip; Continue Reading CodeIgniter Image Upload and Crop,resize","og_url":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/","og_site_name":"PHEONIXSOLUTIONS","article_publisher":"https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","article_published_time":"2017-06-02T07:55:30+00:00","article_modified_time":"2017-11-08T15:31:09+00:00","og_image":[{"width":3837,"height":2540,"url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/PX2.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@pheonixsolution","twitter_site":"@pheonixsolution","twitter_misc":{"Written by":"admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/#article","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/"},"author":{"name":"admin","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503"},"headline":"CodeIgniter Image Upload and Crop,resize","datePublished":"2017-06-02T07:55:30+00:00","dateModified":"2017-11-08T15:31:09+00:00","mainEntityOfPage":{"@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/"},"wordCount":138,"commentCount":3,"publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"keywords":["codeigniter","php"],"articleSection":["Codeigniter","PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/","url":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/","name":"Pheonix Solutions - We Empower Your Business Growth","isPartOf":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#website"},"datePublished":"2017-06-02T07:55:30+00:00","dateModified":"2017-11-08T15:31:09+00:00","breadcrumb":{"@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/pheonixsolutions.com\/blog\/codeigniter-image-upload-crop-resize\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pheonixsolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"CodeIgniter Image Upload and Crop,resize"}]},{"@type":"WebSite","@id":"https:\/\/pheonixsolutions.com\/blog\/#website","url":"https:\/\/pheonixsolutions.com\/blog\/","name":"Pheonix Solutions","description":"We Empower Your Business Growth","publisher":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pheonixsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/pheonixsolutions.com\/blog\/#organization","name":"PheonixSolutions","url":"https:\/\/pheonixsolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","contentUrl":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/logo.png","width":454,"height":300,"caption":"PheonixSolutions"},"image":{"@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/PheonixSolutions-209942982759387\/","https:\/\/x.com\/pheonixsolution"]},{"@type":"Person","@id":"https:\/\/pheonixsolutions.com\/blog\/#\/schema\/person\/0ffa33d73c869faec2d50e79c24e3503","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09bacc0294abee1322a23ab4bc6a0330dd4cb4df707dc9d0b0efeba6c109608b?s=96&r=g","caption":"admin"},"sameAs":["http:\/\/blog.pheonixsolutions.com"],"url":"https:\/\/pheonixsolutions.com\/blog\/author\/admin\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7F4uM-pg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1566"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1566\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}