Image Beacon Requests DEPRECATED
510372
function sendBeacon(url, callback){
  var self = this,
      img = document.createElement('img'),
      loaded = false;

  img.onload = function() {
    loaded = true;
    if ('naturalHeight' in this) {
      if (this.naturalHeight + this.naturalWidth === 0) {
        this.onerror();
        return;
      }
    } else if (this.width + this.height === 0) {
      this.onerror();
      return;
    }
    if (callback) {
      callback.call(self);
    }
  };
  img.onerror = function() {
    loaded = true;
    if (callback) {
      callback.call(self, 'An error occurred!', null);
    }
  };
  img.src = url + '&c=clv1';
}
741842
function wireUsePhotoHandlers(){
    
    $usePhoto.bind('click submit', function(e){
       
      if(e.target.id === 'facebook-use-photo'){
        
        // We don't want to show the facebook option, because
        // it is the source of the image.
        $facebookDestination.hide()

        _photoToUse = localStorage.imageToPipe || $('.one-up:visible').find('img')[0].src
        
        closeOneUp()
        
        $stepFourDestinationWrapper.show()

        progressToNextStep($stepThree, function(){

          $stepFour.slideDown(333)

        })

      }

      if(e.target.id === 'twitter-use-photo'){
        
        // We don't want to show the facebook option, because
        // it is the source of the image.
        $twitterDestination.hide()
        
        _photoToUse = localStorage.imageToPipe || $('.one-up:visible').find('img')[0].src
                
        closeOneUp()

        $stepThreeDestinationWrapper.show()
        
        progressToNextStep($stepTwo, function(){

          $stepThree.slideDown(333)

        })

      }


      if(e.target.id === 'url-use-photo'){
        
        _photoToUse = $photoFromUrl.val() || localStorage.imageToPipe
        
        $stepThreeDestinationWrapper.show()
        
        progressToNextStep($stepTwo, function(){

          $stepThree.slideDown(333)

        })

      }
      
      localStorage.imageToPipe = _photoToUse

      console.log(_photoToUse)
      console.log(localStorage.imageToPipe)
      return false

    }) // end bind()
    
  }
551560
function filterImageUrls (elem, urls) {
        var child = elem.firstChild;
        while (child) {
            if (child.tagName == 'IMG') {
                var url = child.src;
                if (urls.indexOf(url) == -1) {
                    urls.push(url);
                }
            }

            filterImageUrls(child, urls);

            child = child.nextSibling;
        }
    }
1369719
function requestAds(adUnit, callback) {
    var limit = _getRequiredAdCountForAdUnit(adUnit);
    var token = page.getToken();
    var imageType = adUnit.imageType;
    if (typeof imageType == 'undefined'){
      imageType = "hq_icon";
    }
    var requestQuery = {
        "output": "json",
        "placement_key": adUnit.placementKey,
        "limit": limit,
        "token": token,
        "auto_device": 1,
        "image_type": imageType
    };

    //noinspection JSUnresolvedVariable
    var overrides = appSettings.overrides;
    if (overrides && overrides.formFactor && overrides.platform && overrides.fullDeviceName && overrides.version) {
        delete requestQuery.auto_device;
        requestQuery.os = overrides.platform;
        requestQuery.model = overrides.fullDeviceName;
        requestQuery.version = overrides.version;
    }

    ajax.get({
        url: appSettings.adApiBaseUrl,
        query: requestQuery,
        success: function (data) {
            if (data.length !== limit) {
                logger.warn("Tried to fetch " + limit + " ads, but received " + data.length);
            }
            data = _buildImageFields(data);
            callback(data);
        },
        error: function (e) {
            logger.wtf('An error occurred trying to fetch ads');
        }
    });
}
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
    
  }
998049
def image_list(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.list_images(**kwargs)
87213
function(imageIdentifier, callback) {
        var url = this.getImageUrl(imageIdentifier, { usePrimaryHost: true }),
            signedUrl = this.getSignedResourceUrl('DELETE', url);

        request.del(signedUrl, callback);
        return this;
    }
913866
def beacon(config):
    '''
    

    '''

    ret = []

    user = config['user']

    locked_accounts = __salt__['shadow.login_failures'](user)
    ret.append({'accounts': locked_accounts})

    return ret
613187
function requirifyImageReference(markdownImageReference) {
  const [, mdImageStart, mdImagePath, optionalMdTitle, mdImageEnd ] = imagePathRE.exec(markdownImageReference) || []
  if (!mdImagePath) {
    return JSON.stringify(markdownImageReference)
  } else {
    const imageRequest = loaderUtils.stringifyRequest(
      this,
      loaderUtils.urlToRequest(mdImagePath)
    )
    const mdImageTitleAndEnd = optionalMdTitle ? JSON.stringify(optionalMdTitle + mdImageEnd) : JSON.stringify(mdImageEnd)

    return `${JSON.stringify(mdImageStart)} + require(${imageRequest}) + ${mdImageTitleAndEnd}`
  }
}
413183
def find_images(ami_name=None, executable_by=None, owners=None, image_ids=None, tags=None,
                region=None, key=None, keyid=None, profile=None, return_objs=False):

    '''
    

    '''
    retries = 30
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    while retries:
        try:
            filter_parameters = {'filters': {}}
            if image_ids:
                filter_parameters['image_ids'] = [image_ids]
            if executable_by:
                filter_parameters['executable_by'] = [executable_by]
            if owners:
                filter_parameters['owners'] = [owners]
            if ami_name:
                filter_parameters['filters']['name'] = ami_name
            if tags:
                for tag_name, tag_value in six.iteritems(tags):
                    filter_parameters['filters']['tag:{0}'.format(tag_name)] = tag_value
            images = conn.get_all_images(**filter_parameters)
            log.debug('The filters criteria %s matched the following '
                      'images:%s', filter_parameters, images)
            if images:
                if return_objs:
                    return images
                return [image.id for image in images]
            else:
                return False
        except boto.exception.BotoServerError as exc:
            if exc.error_code == 'Throttling':
                log.debug("Throttled by AWS API, will retry in 5 seconds...")
                time.sleep(5)
                retries -= 1
                continue
            log.error('Failed to convert AMI name `%s` to an AMI ID: %s', ami_name, exc)
            return False
    return False
1294674
def image_url(self):
        """"""
        return construct_api_url(self.input, 'image', self.resolvers, False, self.get3d, False, **self.kwargs)
579853
def avail_images(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-images option'
        )

    items = query(action='template')
    ret = {}
    for item in items:
        ret[item.attrib['name']] = item.attrib

    return ret
1241337
def iiif_image_handler(prefix=None, identifier=None,
                       path=None, config=None, klass=None, auth=None, **args):
    
    if (not auth or degraded_request(identifier) or auth.image_authz()):
        # serve image
        if (auth):
            logging.debug("Authorized for image %s" % identifier)
        i = IIIFHandler(prefix, identifier, config, klass, auth)
        try:
            return i.image_request_response(path)
        except IIIFError as e:
            return i.error_response(e)
    else:
        # redirect to degraded (for not authz and for authn but not authz too)
        degraded_uri = host_port_prefix(
            config.host, config.port, prefix) + '/' + identifier + '-deg/' + path
        logging.info("Redirection to degraded: %s" % degraded_uri)
        response = redirect(degraded_uri)
        response.headers['Access-control-allow-origin'] = '*'
        return response
1026113
def avail_images(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudException(
            'The avail_images function must be called with -f or --function.'
        )

    ret = {}

    vm_ = get_configured_provider()
    manager = packet.Manager(auth_token=vm_['token'])

    ret = {}

    for os_system in manager.list_operating_systems():
        ret[os_system.name] = os_system.__dict__

    return ret
731798
def beacon(config):
    '''
    
    '''
    ret = []

    users = {}
    groups = {}
    defaults = None

    for config_item in config:
        if 'users' in config_item:
            users = config_item['users']

        if 'groups' in config_item:
            groups = config_item['groups']

        if 'defaults' in config_item:
            defaults = config_item['defaults']

    with salt.utils.files.fopen(BTMP, 'rb') as fp_:
        loc = __context__.get(LOC_KEY, 0)
        if loc == 0:
            fp_.seek(0, 2)
            __context__[LOC_KEY] = fp_.tell()
            return ret
        else:
            fp_.seek(loc)
        while True:
            now = datetime.datetime.now()
            raw = fp_.read(SIZE)
            if len(raw) != SIZE:
                return ret
            __context__[LOC_KEY] = fp_.tell()
            pack = struct.unpack(FMT, raw)
            event = {}
            for ind, field in enumerate(FIELDS):
                event[field] = pack[ind]
                if isinstance(event[field], salt.ext.six.string_types):
                    if isinstance(event[field], bytes):
                        event[field] = salt.utils.stringutils.to_unicode(event[field])
                    event[field] = event[field].strip('\x00')

            for group in groups:
                _gather_group_members(group, groups, users)

            if users:
                if event['user'] in users:
                    _user = users[event['user']]
                    if isinstance(_user, dict) and 'time_range' in _user:
                        if _check_time_range(_user['time_range'], now):
                            ret.append(event)
                    else:
                        if defaults and 'time_range' in defaults:
                            if _check_time_range(defaults['time_range'],
                                                 now):
                                ret.append(event)
                        else:
                            ret.append(event)
            else:
                if defaults and 'time_range' in defaults:
                    if _check_time_range(defaults['time_range'], now):
                        ret.append(event)
                else:
                    ret.append(event)
    return ret
946082
def avail_images(kwargs=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-images option'
        )

    if not isinstance(kwargs, dict):
        kwargs = {}

    if 'owner' in kwargs:
        owner = kwargs['owner']
    else:
        provider = get_configured_provider()

        owner = config.get_cloud_config_value(
            'owner', provider, __opts__, default='amazon'
        )

    ret = {}
    params = {'Action': 'DescribeImages',
              'Owner': owner}
    images = aws.query(params,
                       location=get_location(),
                       provider=get_provider(),
                       opts=__opts__,
                       sigver='4')

    for image in images:
        ret[image['imageId']] = image
    return ret
687372
def beacons_refresh(self):
        '''
        
        '''
        log.debug('Refreshing beacons.')
        self.beacons = salt.beacons.Beacon(self.opts, self.functions)