title: showing this message "index row requires (some large) bytes, maximum size is 8191" in postgresql
body: <p>I am trying to insert a query with image as binary value in postgresql, but showing this message "index row requires (some large) bytes, maximum size is 8191". The field for storing the binary value is given as text.</p>
  
  <p>The code i used to compress and create binary format of the image is give below:</p>
  
  <pre><code>$source_img = $imgdocument["tmp_name"];
  $destination_img = '../temp/cancel_doc_image_'.trim($details['val']).'_'.$key.'.jpg';
  $compressed = compress($source_img, $destination_img, 10);            
  $photo_get  = file_get_contents($destination_img);
  list($width, $height, $image_type) = getimagesize($destination_img);
  $mime_photo= image_type_to_mime_type($image_type);
  $photo_en = base64_encode($photo_get);
  $details['document'][$key]['imgdocument'] = data:".$mime_photo.";base64,".$photo_en;
  </code></pre>
  
  <p>The function for compression of image what is used is given below</p>
  
  <pre><code>function compress($source, $destination, $quality)
  {
      $info = getimagesize($source);
  
      if ($info['mime'] == 'image/jpeg')
      {
          $image = imagecreatefromjpeg($source);
      }   
      elseif ($info['mime'] == 'image/gif') 
      {
          $image = imagecreatefromgif($source);
      }
      elseif ($info['mime'] == 'image/png') 
      {
          $image = imagecreatefrompng($source);
      }
      imagejpeg($image, $destination, $quality);
      return $destination;
  }
  </code></pre>
  
  <p>Image</p>
  
  <p><img src="https://i.stack.imgur.com/DIm0M.png" alt="enter image description here"></p>