Advertisement:

Author Topic: Facing problems with the plugin Profile Picture on Item page  (Read 189 times)

786sujit

  • Newbie
  • *
  • Posts: 42
Facing problems with the plugin Profile Picture on Item page
« on: August 01, 2019, 02:28:59 am »
Hi,
    I have installed the plugin Profile Picture by Jesse on my Osclass 3.8.0 with EVA theme.
I placed the codes on all the files where I want the profile image to display. Everything works correct except on Item Page.

On Item Page,
1. Its showing the same image for all users.
2. The profile photo height is not in ratio. Whereas when I delete the photo, then the default no_picture.jpg is shown correctly.

Note:- User uploaded images are used of same dimensions (114 by 114) and type .jpeg like the no_picture.jpg Still facing this issue on Item page.

And if I uninstall the plugin, then many blocks on Item page doesn't show at all, unless the plugin is reinstalled back.

Somebody HELP !

Plugin downloaded from : https://forums.osclass.org/plugins/(new-plugin)-upload-profile-picture/
« Last Edit: August 01, 2019, 02:37:12 am by 786sujit »

WEBmods

  • Hero Member
  • *****
  • Posts: 983
Re: Facing problems with the plugin Profile Picture on Item page
« Reply #1 on: August 15, 2019, 12:00:58 am »
Hello!

Quote
And if I uninstall the plugin, then many blocks on Item page doesn't show at all, unless the plugin is reinstalled back.
You need to remove codes you added before you uninstall the plugin.

To show the profile picture on the user page, you need to create a custom function. The current function, aka profile_picture_show() works only for logged in user / public profile page.

Add this function to plugin's index.php file:

Code: [Select]
function profile_picture_show_custom($id){

   // Configuration - Your Options ///////////////////////////////////////////////////////

    // Specify display width of picture (height will be automatically calculated proprotionally)
    $maxwidth = '120';


    ////// ***** No modifications below here should be needed ***** /////////////////////

    // First, check to see if user has existing profile picture...
    $user_id = $id // the user id of the user profile we're at

    $conn = getConnection();
    $result=$conn->osc_dbFetchResult("SELECT user_id, pic_ext FROM %st_profile_picture WHERE user_id = '%d' ", DB_TABLE_PREFIX, $user_id);

    if($result>0) //if picture exists
    {
$upload_path = osc_plugins_path().'profile_picture/images/';

        list($width, $height, $type, $attr)= getimagesize($upload_path.'profile'.$user_id.$result['pic_ext']);

// Calculate display heigh/width based on max size specified
$ratio = $width/$height;
$height = $maxwidth/$ratio;

$modtime = filemtime($upload_path.'profile'.$user_id.$result['pic_ext']); //ensures browser cache is refreshed if newer version of picture exists
// This is the picture HTML code displayed on page
echo '<img src="'.osc_base_url() . 'oc-content/plugins/profile_picture/images/profile'.$user_id.$result['pic_ext'].'?'.$modtime.'" width="'.$maxwidth.'" height="'.$height.'">'; // display picture
    }
    else{
echo '<img src="'.osc_base_url() . 'oc-content/plugins/profile_picture/no_picture.jpg" width="'.$width.'" height="'.$height.'">';
    }
}

Then you can show the profile picture of the user on the item page with this code: profile_picture_show_custom(osc_item_user_id())

Sorry for the late response, regards.

786sujit

  • Newbie
  • *
  • Posts: 42
Re: Facing problems with the plugin Profile Picture on Item page
« Reply #2 on: August 18, 2019, 02:17:48 am »
Thanks a lot WEBmods,
                                  YES, now its working correctly on item page too.