Last active
May 4, 2017 07:45
-
-
Save pramod1988/a2b129b4188706663d26c8643dcc8f64 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
<?php | |
function imageUrl($path, $width = NULL, $height = NULL,$quality=NULL,$crop=NULL) { | |
if(!$width && !$height) { | |
$url = env(‘IMAGE_URL’) . $path; | |
} else { | |
$url = url(‘/’) . ‘/timthumb.php?src=’ . env(‘IMAGE_URL’) . $path; | |
if(isset($width)) { | |
$url .= ‘&w=’ . $width; | |
} | |
if(isset($height) && $height>0) { | |
$url .= ‘&h=’ .$height; | |
} | |
if(isset($crop)) | |
{ | |
$url .= “&zc=”.$crop; | |
} | |
else | |
{ | |
$url .= “&zc=1”; | |
} | |
if(isset($quality)) | |
{ | |
$url .=’&q=’.$quality.’&s=1'; | |
} | |
else | |
{ | |
$url .=’&q=95&s=1'; | |
} | |
} | |
return $url; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment