From 4d8064af284314c94f3ce6c8554d4068bab9283b Mon Sep 17 00:00:00 2001 From: Harshvardhan Malpani <2611741+harshvardhanmalpani@users.noreply.github.com> Date: Mon, 3 Jun 2019 10:56:29 +0530 Subject: [PATCH] + getLatestImage - returns latest image of a user --- app/lib/functions.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/lib/functions.php b/app/lib/functions.php index 180e137..a981d06 100644 --- a/app/lib/functions.php +++ b/app/lib/functions.php @@ -463,6 +463,17 @@ function get_users_image_url($filename) { return get_content_url('images/users/'.$filename); } +function getLatestImage($user) +{ + + $db = DB::getInstance(); + $db->query('select image_name,image_extension,image_date FROM '.DB::getTable('images').' where `image_user_id`='.$user.' order by image_date desc limit 1'); + $user_images = $db->fetchAll(); + $st=strtotime($user_images[0]['image_date']); + $dloc='/'.getSetting('upload_image_path').date("/Y/m/d/",$st); + return array($user_images[0]['image_name'],$dloc.$user_images[0]['image_name'].'.'.$user_images[0]['image_extension']); +} + /** * Some G\ overrides */