lib/API.php
protected function encode_attachment($path) {
      if (!is_string($path)) {
          $e = sprintf("inline parameter must be path to file as string, received: %s", gettype($path));
          throw new API_Error($e);
      }

      $file_data = file_get_contents($path);

      return base64_encode($file_data);
    }
protected function encode_attachment($path) {
      if (!is_string($path)) {
          $e = sprintf("inline parameter must be path to file as string, received: %s", gettype($path));
          throw new API_Error($e);
      }

      $file_data = file_get_contents($path);

      return base64_encode($file_data);
    }
protected function encode_attachment ( $ path ) { if ( ! is_string ( $ path ) ) { $ e = sprintf ( "inline parameter must be path to file as string, received: %s" , gettype ( $ path ) ) ; throw new API_Error ( $ e ) ; } $ file_data = file_get_contents ( $ path ) ; return base64_encode ( $ file_data ) ; }
Helper function to Base64 encode files and return the encoded data

@param string $path Local path of the file to encode
@return string/false the encoded file data or false on failure
Helper function to Base64 encode files and return the encoded data