Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include 'imageEdit.php';
- function roundImage($image, $size, $text){
- $corner = $size.'Corner';
- switch($size){
- case 'xSmall':
- $bgPos = '3px';
- $pad = '1px';
- $fontStyle = 'normal';
- $fontSize = '7px;';
- $imageSize = 25;
- case 'small':
- $bgPos = '5px';
- $pad = '1px';
- $fontStyle = 'normal';
- $fontSize = '8px;';
- $imageSize = 50;
- break;
- case 'medium':
- $bgPos = '10px';
- $pad = '2px';
- $fontStyle = 'normal';
- $fontSize = '9px;';
- $imageSize = 85;
- break;
- case 'big';
- $bgPos = '15px';
- $pad = '5px';
- $fontStyle = 'italic';
- $fontSize = '11px;';
- $imageSize = 225;
- break;
- }
- $thisImage = new createImage();
- $thisImage -> load(substr($image,1));
- $w = $thisImage -> getWidth();
- $h = $thisImage -> getHeight();
- if($w > $h){
- $thisImage -> resizeToHeight($imageSize);
- }else{
- $thisImage -> resizeToWidth($imageSize);
- }
- $h = $thisImage -> getHeight();
- $w = $thisImage -> getWidth();
- $thisImage = '';
- if($text != false){
- $imageText = '<div class="hoverText"><p style="padding:'.$pad.'; font-style:'.$fontStyle.'; font-size:'.$fontSize.';">'.$text.'</p></div>';
- }
- return '<div class="'.$size.'Image">'.imageElement($image, $w, $h, $imageSize).$imageText.'</div><div class="topLeftCorner '.$corner.'"></div><div class="topRightCorner '.$corner.'"></div><div class="bottomLeftCorner '.$corner.'"></div><div class="bottomRightCorner '.$corner.'"></div>';
- }
- function imageElement($imagePath, $width, $height, $maxSize){
- $style = '';
- if($width < $height){
- $style .= 'width:'.$maxSize.'px;';
- $style .= 'bottom: -'.ceil(($height - $maxSize) / 2).'px;';
- $style .= 'left: 0px;';
- }else{
- $style .= 'height:'.$maxSize.'px;';
- $style .= 'left: -'.ceil(($width - $maxSize) / 2).'px;';
- $style .= 'bottom:0px;';
- }
- return '<img src="'.$imagePath.'" style="position:absolute;'.$style.'" />';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement