title: toDataURL() return blank image from iOS devices
body: <p>i use following code to crop the image and save it</p>
  
  <pre><code>this.crop = function(width, height, type) {
              var imgInfo = this.imgInfo,
                  c = this.eles.container,
                  img = this.eles.img,
                  original = new Image(),
                  canvas = document.createElement('canvas');
              original.src = img.attr('src');
              canvas.width = width;
              canvas.height = height;
  
              var w = Math.round(c.width() * (imgInfo.aw / (imgInfo.w * imgInfo.s))),
                  h = Math.round(c.height() * (imgInfo.ah / (imgInfo.h * imgInfo.s))),
                  x = Math.round(-parseInt(img.css('left')) * (imgInfo.aw / (imgInfo.w * imgInfo.s))),
                  y = Math.round(-parseInt(img.css('top')) * (imgInfo.ah / (imgInfo.h * imgInfo.s)));
              canvas.getContext('2d').drawImage(original, x, y, w, h, 0, 0, width, height);
              return {
                  width: width,
                  height: height,
                  type: type || 'jpeg',
                  string: canvas.toDataURL("image/" + type || 'jpeg'),
              };
          };
  </code></pre>
  
  <p>But when i convert it to image and then upload to the server. uploaded image is blank.</p>
  
  <p>for this i use following code from the save.php file</p>
  
  <pre><code>&lt;?php
  if($_SERVER['REQUEST_METHOD'] == "POST") {
      define('UPLOAD_DIR', 'img/catalog/');
  
      $base64 = base64_decode(preg_replace('#^data:image/[^;]+;base64,#', '', $_POST['string']));
      $stamp = imagecreatefrompng('img/water.png');
      $im = imagecreatefromstring($base64);
      ob_start();
  
      $marge_right = 10;
      $marge_bottom = 10;
      $sx = imagesx($stamp);
      $sy = imagesy($stamp);
  
      imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
  
      $file = UPLOAD_DIR . uniqid() . '.jpg';
      header('Content-type: image/');
      $success = imagejpeg($im, $file, 100);
      imagedestroy($im);
      echo "$file";
  
      }
  
  ?&gt;
  </code></pre>
  
  <p>From PC everything working fine, but when i upload an image from any mobile devices image is blank. when i zoom it to max size everything working fine.</p>
  
  <p>Can you tell me where i'm wrong?</p>