/**
  * Get user profile photo of the profile or gravatar site.
  * The parameter $force_img force a default image.
  * 
  * @param int $user_id
  * @param string $size
  * @param bool $force_img
  * @return false|array
  */
 function educator_get_user_profile_photo($user_id, $size = 'thumbnail', $force_img = false)
 {
     $attachment = $force_img ? get_user_meta($user_id) : get_user_meta($user_id, '_educator_photo', true);
     if (empty($attachment) && !$force_img) {
         return false;
     }
     if (class_exists('IB_Retina') && !is_array($attachment)) {
         return IB_Retina::get_2x_image_html($attachment, $size);
     }
     $_size = 300;
     //Medium post thumnail
     if (is_numeric($size)) {
         $_size = $size;
     } elseif (is_array($size)) {
         $_size = $size[0];
     } else {
         switch ($size) {
             case 'thumbnail':
                 $_size = 150;
                 break;
             case 'large':
                 $_size = 640;
         }
     }
     return $force_img ? get_avatar($user_id, $_size) : wp_get_attachment_image($attachment, $size);
 }
 /**
  * Get user profile photo.
  *
  * @param int $user_id
  * @param string $size
  * @return false|array
  */
 function educator_get_user_profile_photo($user_id, $size = 'thumbnail')
 {
     $attachment_id = get_user_meta($user_id, '_educator_photo', true);
     if (!$attachment_id) {
         return false;
     }
     if (class_exists('IB_Retina')) {
         return IB_Retina::get_2x_image_html($attachment_id, $size);
     }
     return wp_get_attachment_image($attachment_id, $size);
 }
Example #3
0
Version: 1.1.0
Author: educatorteam
Author URI: http://educatorplugin.com
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ib-retina
*/
/*
Copyright (C) 2015 http://educatorplugin.com/ - contact@educatorplugin.com

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
define('IB_RETINA_URL', plugins_url('', __FILE__));
require_once 'include/ib-retina.php';
IB_Retina::init();
if (is_admin()) {
    require_once 'include/ib-retina-admin.php';
    IB_Retina_Admin::init();
}