Checks if img_id is valid.
540642
def is_img_id_valid(img_id):
    
    t = re.sub(r'[^a-z0-9_:\-\.]', '', img_id, re.IGNORECASE)
    t = re.sub(r'\.+', '.', t)
    if img_id != t or img_id.count(':') != 1:
        return False
    profile, base_name = img_id.split(':', 1)
    if not profile or not base_name:
        return False
    try:
        get_profile_configs(profile)
    except ValueError:
        return False
    return True
998779
public function valid()
    {
        if ($this->_index == count($this->_items) && $this->_batchIndex < count($this->_ids)) {
            $this->_getNextPage();
        }

        if ($this->_index < count($this->_items)) {
            return true;
        } else {
            return false;
        }
    }
48257
def is_valid(cls, oid):
        
        if not oid:
            return False

        try:
            ObjectId(oid)
            return True
        except (InvalidId, TypeError):
            return False
989204
def verify_exif(filename):
    '''
    
    '''
    # required tags in IFD name convention
    required_exif = required_fields()
    exif = ExifRead(filename)
    required_exif_exist = exif.fields_exist(required_exif)
    return required_exif_exist
515564
public function valid()
    {

        if (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['picture'])) {
            return false;
        }
        if ($this->container['section'] === null) {
            return false;
        }
        return true;
    }
446724
function isValidID(id) {
  return id === '' || (
    id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
  );
}
1071768
public function checkPageSubjectInImageAltTags() {

        $html = $this->getPageContent();

        // for newly created page
        if ($html == '') {
            return false;
        }

        $dom = $this->createDOMDocumentFromHTML($html);

        $images = $dom->getElementsByTagName('img');

        foreach($images as $image){
            if($image->hasAttribute('alt') && $image->getAttribute('alt') != ''){
                if (preg_match('/' . preg_quote($this->owner->SEOPageSubject, '/') . '/i', $image->getAttribute('alt'))) {
                    return true;
                }
            }
        }

        return false;
    }
57411
def is_valid(self):
        """"""

        try:
            request = self.get_oauth_request()
            client = self.get_client(request)
            params = self._server.verify_request(request, client, None)
        except Exception as e:
            raise e

        return client
447985
def valid_id(opts, id_):
    '''
    
    '''
    try:
        if any(x in id_ for x in ('/', '\\', str('\0'))):
            return False
        return bool(clean_path(opts['pki_dir'], id_))
    except (AttributeError, KeyError, TypeError, UnicodeDecodeError):
        return False
86959
private function checkImageAltTags() {

        $html = $this->getPageContent();

        // for newly created page
        if ($html == '') {
            return false;
        }

        $dom = $this->createDOMDocumentFromHTML($html);

        $images = $dom->getElementsByTagName('img');

        $imagesWithAltTags = 0;
        foreach($images as $image){
            if($image->hasAttribute('alt') && $image->getAttribute('alt') != ''){
                $imagesWithAltTags++;
            }
        }
        if($imagesWithAltTags == $images->length){
            return true;
        }

        return false;
    }
793926
protected function validateImages()
    {
        $field = 'images';
        $images = $this->getSubmitted($field);

        if (empty($images) || !is_array($images)) {
            $this->unsetSubmitted($field);
            return null;
        }

        foreach ($images as &$image) {

            if (isset($image['title'])) {
                $image['title'] = mb_strimwidth($image['title'], 0, 255, '');
            }

            if (isset($image['description'])) {
                $image['description'] = mb_strimwidth($image['description'], 0, 255, '');
            }

            if (empty($image['translation'])) {
                continue;
            }

            foreach ($image['translation'] as $lang => &$translation) {
                foreach ($translation as $key => &$value) {
                    if ($value === '') {
                        unset($image['translation'][$lang][$key]);
                        continue;
                    }
                    $value = mb_strimwidth($value, 0, 255, '');
                }

                if (empty($image['translation'][$lang])) {
                    unset($image['translation'][$lang]);
                    continue;
                }
            }
        }

        $this->setSubmitted($field, $images);
        return true;
    }
317718
def is_img_id_exists(img_id):
    
    main_rel_path = get_relative_path_from_img_id(img_id)
    main_path = media_path(main_rel_path)
    return os.path.isfile(main_path)
239515
def is_valid_image(self, raw_data):
        
        with NamedTemporaryFile(mode='wb') as fp:
            fp.write(raw_data)
            fp.flush()
            args = settings.THUMBNAIL_IDENTIFY.split(' ')
            args.append(fp.name + '[0]')
            p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            retcode = p.wait()
        return retcode == 0
270658
public function isAvailable()
    {
        // First, test Imagick's extension and classes.
        if (false === extension_loaded('imagick') ||
            false === class_exists('Imagick') ||
            false === class_exists('ImagickDraw') ||
            false === class_exists('ImagickPixel') ||
            false === class_exists('ImagickPixelIterator')
        ) {
            return false;
        }

        return true;
    }
255310
function isImageAliasValid( $alias )
    {
        $aliasName = $alias['name'];
        if ( isset( $this->AliasList[$aliasName] ) )
        {
            $aliasKey = $alias['alias_key'];
            $aliasInfo = $this->AliasList[$aliasName];
            $checkKey = $aliasInfo['alias_key'];
            $isValid = ( $aliasKey == $checkKey );
            if ( $isValid )
            {
                $aliasTimestamp = $alias['timestamp'];
                $isValid = $this->isImageTimestampValid( $aliasTimestamp );
            }
            return $isValid;
        }
        return false;
    }
718888
def is_marked?(id, ignore_errors = false)
      (blob = find_blob(id)) && blob.is_marked?(id, ignore_errors)
    end
1374888
public function isValid()
    {
        /**
         * First, check if the upload is valid or not
         */
        if (!parent::isValid()) {
            return false;
        }

        $value = $this->field->getValue();

        // if here, we know that the field is uploaded.

        // check if it's an image, and get it's size
        $size = @getimagesize($value['tmp_name']);
        if ($size === false) {
            $this->setErrorMessage($this->messages['not_an_image']);
            return false;
        }
        list ($width, $height) = $size;

        /**
         * Validate the aspect ratio.
         */
        if (!$this->validateAspectRatio($width, $height)) {
            return false;
        }


        /**
         * Validate the proportions
         */
        if (!$this->validateSize($width, $height)) {
            return false;
        }

        // if here, everything is ok!
        return true;
    }