• [MOD] Show user images in profile 4 0 5 1
Currently:  

Author Topic: [MOD] Show user images in profile  (Read 91994 times)

0 Members and 1 Guest are viewing this topic.

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Show user images in profile
« Reply #60 on: October 24, 2011, 02:31:28 PM »
It's a great MOD, but will get performance problems (if you are not using your own cache). This post is for people with performance problems.
I removed the paging (since when you click on "show all images by XXX" it shows you all images with paging anyway). And I get rid of all the $row calculations,
since it really slows down anything (not just here, I would suggest you get rid of it anywhere).

So the best solution to solve performance problems is placing your thumbnails into <div> containers like this:

1. The modified PHP

Code: [Select]
//-----------------------------------------------------
//--- START Show user images in profile ---------------
//-----------------------------------------------------


$sql3 = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT 5";

$result = $site_db->query($sql3);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $user_profile_images .= $lang['no_new_images'];
}
else  {
  while ($image_row = $site_db->fetch_array($result)){
    show_image($image_row);
    $user_profile_images .= $site_template->parse_template("thumbnail_bit_profile");
  } // end while
} // end else


$site_template->register_vars("user_profile_images", $user_profile_images);
$site_template->register_vars("lang_user_profile_images", $lang['user_profile_images']);
unset($user_profile_images);
//-----------------------------------------------------
//--- END Show user images in profile -----------------
//-----------------------------------------------------

Less code --> Less Queries --> More performance

Then create a thumbnail_bit_profile with <div>'s
(just an example)

Code: [Select]
<div style="float: left; padding-left: 32px; padding-bottom: 20px;">
<div style="width: 210px; border: 1px solid #dddddd; padding: 1px;">
<div class="imgteaser">
<a href="details.php?image_id={image_id}&mode=search"><img src="data/thumbnails/{cat_id}/{thumbnail_file_name}" width="210" height="210">
</a>
</div>
</div>
</div>

and finally use {user_profile_images} inside a table in your member_profile.html










Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: [MOD] Show user images in profile
« Reply #61 on: October 24, 2011, 09:25:54 PM »
thx

Offline milanNN

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.planesphotos.net
Re: [MOD] Show user images in profile
« Reply #62 on: February 19, 2012, 08:03:02 AM »
Could you help me to show photos one by one in row not in column.

Rembrandt

  • Guest
Re: [MOD] Show user images in profile
« Reply #63 on: February 19, 2012, 09:48:47 AM »
Could you help me to show photos one by one in row not in column.

search in the code:
$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);

insert above:
$config['image_cells'] = 1;


mfg Andi

Offline milanNN

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.planesphotos.net
Re: [MOD] Show user images in profile
« Reply #64 on: February 19, 2012, 10:46:25 AM »
Could you help me to show photos one by one in row not in column.

search in the code:
$imgtable_width ceil(intval($config['image_table_width']) / $config['image_cells']);

insert above:
$config['image_cells'] = 1;


mfg Andi
It doesn't help. (