Created
July 10, 2018 19:49
-
-
Save abutler3/00c59e544b3d6bbd1189d47dee5c373b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is this a photo stored in the site (for a Person node)? | |
// if so, we can use Image Styles to generate the different sizes needed | |
if(strpos($photo_uri,"public:") === 0){ | |
$regular = image_style_url($preset,$photo_uri); | |
$retina = image_style_url($preset . "_2x",$photo_uri); | |
$img_properties = image_get_info(image_style_path($preset, $photo_uri )); | |
$photo_height = $img_properties['height']; | |
$photo_width = $img_properties['width']; | |
} else { | |
// We have to explicitly specify the dimensions for photos coming from the photo services feed | |
// which are generally 5x7 and will be padded to fill the extra space | |
if($preset == "barista_person_list_thumbnail"){ | |
$photo_width = 128; | |
$photo_height = 180; | |
} elseif($preset == "barista_person_photo_grid_thumbnail"){ | |
$photo_width = 128; | |
$photo_height = 180; | |
} else { | |
$photo_width = 190; | |
$photo_height = 264; | |
} | |
$regular = str_replace(array("WIDTH","HEIGHT"),array($photo_width,$photo_height),$photo_uri); | |
$retina = null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment