Advertisement:

Author Topic: <SOLVED by teseo > Show Profile Picture at custom page  (Read 1317 times)

jhosua

  • Newbie
  • *
  • Posts: 24
<SOLVED by teseo > Show Profile Picture at custom page
« on: December 15, 2016, 09:24:33 pm »
hi all
im trying make table list of user and company at a custom page.
and i use plugin Upload Profile Picture = http://forums.osclass.org/plugins/(new-plugin)-upload-profile-picture/
to show profile picture at my custom page.

when i use <?php profile_picture_show(); ?>
result =  no_picture.jpg image show in all profile

when i use code from here : http://forums.osclass.org/plugins-20/how-to-display-list-of-company-23215/
Code: [Select]
<?php echo '<img src="'.osc_base_url(true) . 'oc-content/plugins/profile_picture/images/profile'.$user['pk_i_id'].".jpg".".png".".gif".'"  .width="150px". height="150px" />' ' <a href="user/profile/'.$user['pk_i_id'].'">'$user['s_name'].'</a>' '<br /> ';?>result= picture not show

my question : how to show profile picture in custom page ?

my custom page :
Code: [Select]
<?php
    
/*
     *      Osclass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2014 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    // meta tag robots
    
osc_add_hook('header','osclasswizards_nofollow_construct');

    
osclasswizards_add_body_class('page');
    
osc_current_web_theme_path('header.php') ;
?>

<div class="title">
  <h1><?php echo osc_static_page_title(); ?></h1>
</div>
<div>
<?php $user User::newInstance()->listAll(); ?>
<?php if (osc_total_users()>0) { ?>
    <table border="1" style="width:100%">
        <tr style="border:thin; border-color:#999; background-color:#CCC;">
            <th>Company</th>
            <th>Phone</th>
            <th>Location</th>
            <th>Register</th>
        </tr>
        <?php foreach ($user as $u) { ?>
            <?php  if($u["b_company"]==1) {?>
         
                <tr>
                    <th>
                    <?php echo '<img src="'.osc_base_url(true) . 'oc-content/plugins/profile_picture/images/profile'.$user['pk_i_id'].".jpg".".png".".gif".'"  .width="150px". height="150px" />' ' <a href="user/profile/'.$user['pk_i_id'].'">'$user['s_name'].'</a>' '<br /> ';?>
                        <a href="<?php echo osc_base_url(true) . '?page=user&action=pub_profile&id='.$u['pk_i_id']; ?>" >
                            <?php echo $u['s_name']; ?>
                        </a>
                    </th>
                    <th><?php echo $u['s_phone_mobile'] ;?></th>
                    <th><?php echo $u['s_country'] ;?></th>
                    <th><?php echo $u['dt_reg_date'] ;?></th>
                </tr>
            <?php ?>
        <?php ?>
    </table><br>
    <table border="1" style="width:100%">
        <tr style="border:thin; border-color:#999; background-color:#CCC;">
            <th>User</th>
            <th>Phone</th>
            <th>Location</th>
            <th>Register</th>
        </tr>
        <?php foreach ($user as $u) { ?>
            <?php  if($u["b_company"]==0) {?>
         
                <tr>
                    <th>
                    <?php echo '<img src="'.osc_base_url(true) . 'oc-content/plugins/profile_picture/images/profile'.$user['pk_i_id'].".jpg".".png".".gif".'"  .width="150px". height="150px" />' ' <a href="user/profile/'.$user['pk_i_id'].'">'$user['s_name'].'</a>' '<br /> ';?>
                        <a href="<?php echo osc_base_url(true) . '?page=user&action=pub_profile&id='.$u['pk_i_id']; ?>" >
                            <?php echo $u['s_name']; ?>
                        </a>
                    </th>
                    <th><?php echo $u['s_phone_mobile'] ;?></th>
                    <th><?php echo $u['s_country'] ;?></th>
                    <th><?php echo $u['dt_reg_date'] ;?></th>
                </tr>
            <?php ?>
        <?php ?>
    </table>

<?php ?>
</div>
<?php osc_current_web_theme_path('footer.php') ; ?>

sorry for my english i use translator
thanks much..
« Last Edit: December 21, 2016, 05:05:49 pm by jhosua »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: <ASK> Show Profile Picture at custom page
« Reply #1 on: December 16, 2016, 11:53:42 pm »
Hi,

This modification would allow you to get the picture:

Code: [Select]
            <?php foreach ($user as $u) { ?>
                <?php  if($u["b_company"]==1) {?>

                    <tr>
                        <th>
                            <?php View::newInstance()->_exportVariableToView('user'$u);
                            
profile_picture_show() ;?>


You need to use that function to get the correct extension of the uploaded picture.

Your problem here is that looks like you want to add a link and custom dimentions to the image, to achieve that you could modify the plugin itself, changing this line in index.php:

Code: [Select]
// 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

Regards
« Last Edit: December 16, 2016, 11:58:47 pm by teseo »

jhosua

  • Newbie
  • *
  • Posts: 24
Re: <SOLVED by teseo > Show Profile Picture at custom page
« Reply #2 on: December 21, 2016, 05:08:10 pm »
 amazing its work 100% thanks much ... teseo
 you help me again.

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: <SOLVED by teseo > Show Profile Picture at custom page
« Reply #3 on: December 21, 2016, 05:15:37 pm »
You're welcome. :)

Regards

jhosua

  • Newbie
  • *
  • Posts: 24
Re: <SOLVED by teseo > Show Profile Picture at custom page
« Reply #4 on: December 29, 2016, 10:48:05 pm »
hi teseo,
how to make pagination for my custom page with code above?
i need to show only 10 user and 10 company in first page,  10 user and 10 company in next page and next page?

Tolgas91

  • Newbie
  • *
  • Posts: 8
Re: <SOLVED by teseo > Show Profile Picture at custom page
« Reply #5 on: June 07, 2018, 09:50:22 pm »
Help please! :(

I do not know where to stick the codes you gave above
which file?
which line?
I did all the things, but don't photos uploaded
And im sorry my english some bad
Me too use google translate