Skip to content

Commit d115a08

Browse files
committed
Adding filetype as parameter
1 parent a53ecc2 commit d115a08

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ding_panels/ding_panels.module

+3-2
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ function template_preprocess_ding_panels_library_user_staff_title(&$variables) {
197197
* Utitlity function for caching remote images locally for 24 hours.
198198
*
199199
* @param $path the path to the image
200+
* @param $image_type the filetype of the saved image
200201
* @return string the local path for the image
201202
*/
202-
function _ding_panels_get_image($path) {
203+
function _ding_panels_get_image($path, $image_type = '.png') {
203204
$return = $path;
204205

205206
$base_path = file_directory_path().'/ding_panels';
@@ -208,7 +209,7 @@ function _ding_panels_get_image($path) {
208209
$cut_path = str_ireplace("http://", "", $path);
209210
$image_name = preg_replace("/[^\w]/", "-", $path);
210211

211-
$image_path = $base_path."/".$image_name . '.png';
212+
$image_path = $base_path . "/" . $image_name . $image_type;
212213
if (file_exists($image_path) &&
213214
time() < (filectime($image_path) + (60*60*24))) {
214215
// File already downloaded and within 24 hours cache lifetime

0 commit comments

Comments
 (0)