send image to browser
970947
public function exportImage( $keep_resorce = false )
	{
		// prepare Capatcha
		$this->getCaptchaImage();

		# Sending Header Info
		header( 'content-type: image/png' );
		
		# Exporting the final image
		imagepng( $this->_final_image );
		
		# Clearing final image from the memory
		imagedestroy( $this->_final_image );

		# Method End
	}
316038
def _image_to_data(img):
    
    # If the image is already encoded in Base64, we have nothing to do here
    if "src" not in img.attrs or img["src"].startswith("data:"):
        return
    elif re.match("https?://", img["src"]):
        img_data = _load_url(img["src"]).read()
    else:
        img_data = _load_file(img["src"]).read()
    img_type = imghdr.what("", img_data)
    img_b64 = base64.b64encode(img_data)
    src_data = "data:image/none;base64,"
    if img_type:
        src_data = "data:image/{};base64,{}".format(img_type, img_b64)
    img["src"] = src_data
1253259
def connect_to_images(region=None, public=True):
    """"""
    return _create_client(ep_name="image", region=region, public=public)
617341
def image_to_file(self, path, get_image=True):
        """"""
        if not self.image_url or get_image:
            if not self.refresh_image():
                return False

        response = requests.get(self.image_url, stream=True)

        if response.status_code != 200:
            _LOGGER.warning(
                "Unexpected response code %s when requesting image: %s",
                str(response.status_code), response.text)
            raise AbodeException((ERROR.CAM_IMAGE_REQUEST_INVALID))

        with open(path, 'wb') as imgfile:
            copyfileobj(response.raw, imgfile)

        return True
114260
function TexImage () {
    TexFlags.call(this)

    this.xOffset = 0
    this.yOffset = 0

    // data
    this.data = null
    this.needsFree = false

    // html element
    this.element = null

    // copyTexImage info
    this.needsCopy = false
  }
88130
def send_file(self, filename, mimetype=None, restricted=True,
                  checksum=None, trusted=False, chunk_size=None,
                  as_attachment=False):
        """"""
        try:
            fp = self.open(mode='rb')
        except Exception as e:
            raise StorageError('Could not send file: {}'.format(e))

        try:
            md5_checksum = None
            if checksum:
                algo, value = checksum.split(':')
                if algo == 'md5':
                    md5_checksum = value

            # Send stream is responsible for closing the file.
            return send_stream(
                fp,
                filename,
                self._size,
                self._modified,
                mimetype=mimetype,
                restricted=restricted,
                etag=checksum,
                content_md5=md5_checksum,
                chunk_size=chunk_size,
                trusted=trusted,
                as_attachment=as_attachment,
            )
        except Exception as e:
            fp.close()
            raise StorageError('Could not send file: {}'.format(e))
239435
function(req, res, router) {
    res.send = function() {
      router.sendFn.apply(res, arguments);
    };
    res.sendImage = function() {
      router.sendImageFn.apply(res, arguments);
    };
    res.render = function(file, context){
      if (typeof router.engine === 'string') {
        var engine = require(router.engine)

        router.fs.readFile(router.view + '/' + file + '.' + router.engine, function (err, data) {
          var _html = engine.render(data.toString(), context)
          res.send(_html)
        })
      } else {
        var engine = require(router.engine.eng)

        router.fs.readFile(router.view + '/' + file + '.' + router.engine.ext, function (err, data) {
          var _html = engine.render(data.toString(), context)
          res.send(_html)
        })
      }
    };
  }
129112
function(url, callback) {
        if (isBrowser) {
            // Browser environments can't pipe, so download the file and add it
            return this.getImageDataFromUrl(url, function(err, data) {
                if (err) {
                    return callback(err);
                }

                this.addImageFromBuffer(data, callback);
            }.bind(this));
        }

        // Pipe the source URL into a POST-request
        request({ uri: url }).pipe(request({
            method: 'POST',
            uri: this.getSignedResourceUrl('POST', this.getImagesUrl()),
            json: true,
            headers: {
                'Accept': 'application/json',
                'User-Agent': 'imboclient-js'
            },
            onComplete: function(err, res, body) {
                callback(err, body ? body.imageIdentifier : null, body, res);
            }
        }));

        return this;
    }
919566
def drawImage(self, image):
        
        padding = image.width() % 4
        for i in range(0, image.height()):
            tmp = image.copy(0, i, image.width() + padding, 1)
            #in RDP image or bottom top encoded
            ptr = tmp.bits()
            ptr.setsize(tmp.byteCount())
            self._controller.sendUpdate(self._dx, i + self._dy, image.width() + self._dx - 1, i + self._dy, tmp.width(), tmp.height(), self._colorDepth, False, ptr.asstring())
699576
def send_media(self, path, chatid, caption):
        
        imgBase64 = self.convert_to_base64(path)
        filename = os.path.split(path)[-1]
        return self.wapi_functions.sendImage(imgBase64, chatid, filename, caption)
1191177
def img(self, id):
        """"""
        return self._serve_file(os.path.join(media_path, 'img', id))
1019166
function(field, canvasImage){
    var buffer32 = canvasImage.buffer32;
    var width = canvasImage.width;
    var height = canvasImage.height;
    for (var y=0; y<height; ++y)
      for (var x=0; x<width; ++x)
        buffer32[y*width+x] = field(x, y);
    canvasImage.imageData.data.set(canvasImage.buffer8);
    canvasImage.context.putImageData(canvasImage.imageData, 0, 0);
    return canvasImage;
  }
126582
def send_image(self, number, path, caption=None):
        
        return self._send_media_path(number, path, RequestUploadIqProtocolEntity.MEDIA_TYPE_IMAGE, caption)
966276
function storedPixelDataToImageData (image) {
  // Transfer image data to alpha channel of WebGL texture
  // Store data in Uint8Array
  const pixelData = image.getPixelData();
  const numberOfChannels = 2;
  const data = new Uint8Array(image.width * image.height * numberOfChannels);
  let offset = 0;

  for (let i = 0; i < pixelData.length; i++) {
    data[offset++] = pixelData[i];
    data[offset++] = pixelData[i] < 0 ? 0 : 1; // 0 For negative, 1 for positive
  }

  return data;
}
810018
function sendScreenshot (name, runId, metaData, properties, compareSettings, png) {
	return _callServer('post', 'runs/' + runId + '/screenshots', null, {
		meta: JSON.stringify(metaData),
		properties: JSON.stringify(properties),
		compareSettings: JSON.stringify(compareSettings),
		screenshotName: name,
		file: {
			value: new Buffer(png, 'base64'),
			options: {
				filename: 'file.png',
				contentType: 'image/png'
			}
		}
	}).catch(function (error) {
		return q.reject('an error occured while sending a screenshot to the VisualReview server: ' + error);
	});
}
1208532
function pipePhotoPostHandler(){

    var fileNameValue =  $('#filename').val() || _photoToUse.split('/').pop() || 'photopipe_'
    var fileExtension = ''
    var hasFileExt = (/\.(gif|jpg|jpeg|png|bmp)/gi.exec(_photoToUse))
    var fileExtension = (hasFileExt && hasFileExt.length) ? hasFileExt[0] : '.jpg'

    fileNameValue = encodeURI( (fileNameValue + fileExtension) )

    // If the filebegins with a question mark, make it empty string
    if(fileNameValue.charAt(0) === '?') fileNameValue = ''
    
    console.dir(hasFileExt)
    console.log(fileExtension)    
    console.log(fileNameValue)    
    console.log(_photoToUse)
    
    $
    .post("/smoke",{
      type: _photoDestination,
      photoUrl: localStorage.imageToPipe,
      filename: fileNameValue,
      caption: $caption.val() || null
    })
    .success(function(data){ 

      $spin.hide()

      if(_photoDestination === 'download'){
        // console.dir(data)
        downloadFile(data)
      }
      else{
        // console.dir(data)
        alert('Success!')
        // window.location = "/"
      }

    })
    .error(function(e) {
      $spin.hide()
      if(e.status === 400) alert(e.responseText || 'Bad request.')
      if(e.status === 401) alert(e.responseText || 'Unauthorized request.')
      if(e.status === 402) alert(e.responseText || 'Forbidden request.')
      if(e.status === 403) alert(e.responseText || 'Forbidden request.')
      if(e.status === 404) alert(e.responseText || 'Images were not found.')
      if(e.status === 405) alert(e.responseText || 'That method is not allowed.')
      if(e.status === 408) alert(e.responseText || 'The request timed out. Try again.')
      if(e.status === 500) alert(e.responseText || 'Something went really wrong.')
      
      // TODO: RESTART AT STEP ONE? 0N 403 YES.
      if(e.status === 403 && (e.responseText.regexIndexOf(/twitter/gi) > -1)) window.location = "/twitter"
      if(e.status === 403 && (e.responseText.regexIndexOf(/facebook/gi) > -1)) window.location = "/facebook"
      if(e.status === 403 && (e.responseText.regexIndexOf(/instagram/gi) > -1)) window.location = "/instagram"
    })
    
    return false
    
  }
467632
def image(request, obj_id):
    """"""
    obj = Image.objects.get(pk=obj_id)
    if request.method == 'POST':
        return post(request, obj)
    elif request.method == 'PUT':
        getPutData(request)
        return put(request, obj)
    elif request.method == 'DELETE':
        getPutData(request)
        return delete(request, obj)