Checks the maximum image height.

@param Model $model
@param array $data
@param int $size
@return bool
540267
public function maxHeight(Model $model, $data, $size) {
        return $this->_validate($model, $data, 'maxHeight', array($size));
    }
164309
private function checkSize(&$size)
    {
        if ( ! NumberChecker::isIntValue($size)) {
            throw new Exceptions\InvalidImageSizeException(
                'Avatar size specified must be an integer.'
            );
        }

        $size = (int) $size;

        if ( ! NumberChecker::isIntBetween($size, 0, 512)) {
            throw new Exceptions\InvalidImageSizeException(
                'Avatar size must be within 0 pixels and 512 pixels.'
            );
        }
    }
284929
protected function doRemovePictures(Skill $model, $data) {
		$errors = [];
		foreach ($data as $entry) {
			if (!isset($entry['id'])) {
				$errors[] = 'Missing id for Picture';
			} else {
				$related = PictureQuery::create()->findOneById($entry['id']);
				$model->removePicture($related);
			}
		}

		if (count($errors) > 0) {
			return new ErrorsException($errors);
		}
	}
778639
public function setImages(array &$data, $file_model, $entity)
    {
        if (empty($data['images']) || empty($data[$entity . '_id'])) {
            return false;
        }

        foreach ($data['images'] as &$image) {
            if (empty($image['file_id'])) {
                $image['entity'] = $entity;
                $image['entity_id'] = $data[$entity . '_id'];
                $image['file_id'] = (int) $file_model->add($image);
            } else {
                $file_model->update($image['file_id'], $image);
            }
        }

        return true;
    }
1094155
private void checkSize(long newSize, long maxSize, HttpServerFileUpload upload) {
        if (maxSize >= 0 && newSize > maxSize) {
            upload.handler(null);
            report(new IllegalStateException("Size exceed allowed maximum capacity"));
        }
    }
878128
public function required(Model $model, $data, $required = true) {
        foreach ($data as $value) {
            if ($required && $this->_isEmpty($value)) {
                return false;
            }
        }

        return true;
    }
514748
protected function includeAvailableIncludes($model, $data )
    {

        // Get available includes from url parameters
        $includes = $this->getAvailableIncludesFromUrlParameters();

        // Create an return array
        $returnData = [];

        // Check if we have includes and include parameter values
        if ( ! empty( $includes ) && ! empty( $this->availableIncludes ) ) {

            // Loop through all includes
            foreach ($this->availableIncludes as $include) {

                // If the words exists in both includes
                if ( in_array( $include, $includes ) ) {

                    // Add the new data
                    $returnData[ $include ] = $this->includeByName( $include, $model );

                }
            }
        }

        // Return data
        return array_merge( $data, $returnData );
    }
565026
public function findImageSize($sizeName)
	{
		if ($this->imageSizes->containsKey($sizeName)) {
			return $this->imageSizes->get($sizeName);
		} else {
			return null;
		}
	}
1017838
public static function get_image_size( $size ) {
		// Check for a directly passed image configuration array.
		if ( is_array( $size ) ) {
			return $size;
		}

		$sizes = self::get_image_sizes();

		// Return found image size.
		if ( isset( $sizes[ $size ] ) ) {
			return $sizes[ $size ];
		}

		self::notice( "Image size \"{$size}\" does not exist in your image configuration." );

		return false;
	}
795051
public function update($model, array $data = [])
    {
        $this->setModelData($model, $data);

        return $this->saveForUpdate($model);
    }
167735
public function resize(Image $image, $width, $height, $method)
    {
        // Get Image Dimensions:
        
        $imageWidth  = $image->getWidth();
        $imageHeight = $image->getHeight();
        
        // Calculate Width and Height (if required):
        
        if ($width && !$height && $imageWidth) {
            $height = round(($width / $imageWidth) * $imageHeight);
        } elseif (!$width && $height && $imageHeight) {
            $width = round(($height / $imageHeight) * $imageWidth);
        }
        
        // Perform Image Resizing:
        
        if ($width && $height) {
            
            switch (strtolower($method)) {
                
                case self::RESIZE_CROP_WIDTH:
                    return $image->CropWidth($width);
                    
                case self::RESIZE_CROP_HEIGHT:
                    return $image->CropHeight($height);
                    
                case self::RESIZE_FILL:
                    return $image->Fill($width, $height);
                    
                case self::RESIZE_FILL_MAX:
                    return $image->FillMax($width, $height);
                    
                case self::RESIZE_FILL_PRIORITY:
                    return $image->FillPriority($width, $height);
                    
                case self::RESIZE_FIT:
                    return $image->Fit($width, $height);
                    
                case self::RESIZE_FIT_MAX:
                    return $image->FitMax($width, $height);
                    
                case self::RESIZE_PAD:
                    return $image->Pad($width, $height);
                    
                case self::RESIZE_SCALE_WIDTH:
                    return $image->ScaleWidth($width);
                    
                case self::RESIZE_SCALE_HEIGHT:
                    return $image->ScaleHeight($height);
                    
                case self::RESIZE_SCALE_MAX_WIDTH:
                    return $image->ScaleMaxWidth($width);
                    
                case self::RESIZE_SCALE_MAX_HEIGHT:
                    return $image->ScaleMaxHeight($height);
                    
            }
            
        }
        
        // Answer Original Image:
        
        return $image;
    }
926589
public function fitHeight(&$source, $target, array $action)
    {
        $height = reset($action['value']);

        if ($this->image->set($source)->fitToHeight($height)->save($target)) {
            $source = $target;
            return true;
        }

        return false;
    }
501145
protected function size($name, $label = null, $data = []) {return $this->quantity(
		$name, $label, $data + [Quantity::P__VALUES => SizeUnit::s()->toOptionArray()]
	);}
598818
public function setModel(\atk4\data\Model $model, $fields = null)
    {
        // dont add any fields automatically
        parent::setModel($model, false);

        if ($fields === null) {
            $fields = $this->getModelFields($model);
        }

        $cnt = count($fields);

        if ($this->col !== null) {
            $col = $this->col;
            $size = $this->size;
        } elseif ($cnt < 10) {
            $col = 1;
            $size = '';
        } elseif ($cnt < 15) {
            $col = 2;
            $size = '';
        } elseif ($cnt < 20) {
            $col = 2;
            $size = 'small';
        } elseif ($cnt < 32) {
            $col = 3;
            $size = 'small';
        } else {
            $col = 4;
            $size = 'tiny';
        }

        if ($size) {
            $this->form->addClass($size);
        }

        $c = $this->add('Columns');

        $chunks = array_chunk($fields, ceil($cnt / $col));
        foreach ($chunks as $chunk) {
            $cc = $c->addColumn();
            $cc->add(['FormLayout/Generic', 'form' => $this->form])->setModel($model, $chunk);
        }

        $this->add(['ui' => 'clearing hidden divider']);

        return $model;
    }
1254022
public function afterSave($model, $data) {
        // Check if the 'published column' is filled...
        if (empty($data[self::PUBLISHED_COLUMN])) {
            return;
        }

        // ...and that it's in the future
        $publishTime = strtotime($data[self::PUBLISHED_COLUMN]);
        if ($publishTime <= time()) {
            return;
        }

        $tags = array(get_class($model));
        $tags = array_merge($tags, $model->getBindableModels());
        $tags = array_unique($tags);
        Garp_Cache_Manager::scheduleClear($publishTime, $tags);
    }
306385
public static function checkModeKanji($size, $data)
    {
        if($size & 1)
            return false;

        for($i=0; $i<$size; $i+=2) {
            $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
            if( $val < 0x8140
            || ($val > 0x9ffc && $val < 0xe040)
            || $val > 0xebbf) {
                return false;
            }
        }

        return true;
    }
1361993
public function maxColumns($size = null)
    {
        if (is_null($size)) {
            $size = $this->baseSize;
        }
        $columnAttribute = $size . 'Columns';

        $this->{$columnAttribute} = $this->getMaxColumns($size);

        return true;
    }