class SassExtentionsCompassFunctionsImageSize in Sassy 7
Compass extension SassScript image size functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions
Hierarchy
Expanded class hierarchy of SassExtentionsCompassFunctionsImageSize
File
- phamlp/
sass/ extensions/ compass/ functions/ imageSize.php, line 18
View source
class SassExtentionsCompassFunctionsImageSize {
# Returns the $width of the image relative to the images directory
public function image_width($image_file) {
$image_size = getimagesize(self::real_path($image_file));
return new SassNumber($image_size[0] . 'px');
}
# Returns the height of the image relative to the images directory
public function image_height($image_file) {
$image_size = getimagesize(self::real_path($image_file));
return new SassNumber($image_size[1] . 'px');
}
private function real_path($image_file) {
$path = $image_file->value;
# Compute the real path to the image on the file stystem if the images_dir is set.
if (SassExtentionsCompassConfig::config('images_path')) {
return SassExtentionsCompassConfig::config('images_path') . DIRECTORY_SEPARATOR . $path;
}
else {
return SassExtentionsCompassConfig::config('project_path') . DIRECTORY_SEPARATOR . $path;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SassExtentionsCompassFunctionsImageSize:: |
public | function | ||
SassExtentionsCompassFunctionsImageSize:: |
public | function | ||
SassExtentionsCompassFunctionsImageSize:: |
private | function |