Author Topic: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"  (Read 11829 times)

0 Members and 1 Guest are viewing this topic.

Offline Uncle Holden

  • Newbie
  • *
  • Posts: 12
    • View Profile
I have been tinkering with this idea for a while. The problems is that I have 4000+ images on my site and everybody is so busy these days that they wouldn't have the patience to see more than a few categories. I want to show them my most impressive shots and hopefully give them enough incentive to dig deeper.

My idea is to add a separate "Portfolio" section where I will display my most impressive work. A few points in this direction:
  • No point duplicating images from /data. Probably it would be best to use a new table to store the image_ids of the selected shots and keep a separate hit count/vote count/rating. Comments/descriptions can be taken from the current images table.
  • Ideally add an option to "Add this image to portfolio" when logged in as an admin and looking at a picture
  • For each picture in the portfolio, add a link to the originating category
  • ...?

If people have further suggestions/ideas, please comment here. Also, if somebody with more PHP skillZ than me is interested in picking this up, it would be awesome. Otherwise I may be able to hack together something but it will be ugly.
« Last Edit: March 07, 2006, 08:50:53 PM by dtabakov »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section
« Reply #1 on: March 07, 2006, 06:56:20 PM »
there was a MOD ... Featured Images ... , but in the old forum and lost by the last great forum-hack ...

[MOD] Featured Images
Missing MODs/FIXes/FAQs

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Uncle Holden

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section
« Reply #2 on: March 07, 2006, 08:39:03 PM »
Everybody keeps referring to "before the hack". Is there any information about what happened/whodunit? I am very curious.

It is time to start chopping then. Will see what I can do  :mrgreen: :mrgreen: :mrgreen:
« Last Edit: March 07, 2006, 08:52:11 PM by dtabakov »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #3 on: March 07, 2006, 09:29:58 PM »
in the meantime you can test this
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Uncle Holden

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #4 on: March 11, 2006, 08:50:15 PM »
Well, it wasn't that hard to do. featured.php is essentially categories.php, except that the SQL code is modified to make a join with one more table.

display.php needs to be modified to display the name and a link the category from which the image is coming. Also, I added a link next to [Edit] and [Delete]: [Add to Featured]. On featured images it is replaced by [Remove from Featured]. Only admin can see those.

functions.php needs a slight tweak to return the proper links for the next and the previous images.

The usual suspects, constants.php and /lang/main.php also needed to be changed.

The code that handles the database manipulation is in /admin/images.php, and is a modification of the code to edit or delete an image.

Here is the final result for me: http://www.dtabakov.com/featured.php

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #5 on: March 12, 2006, 11:01:16 PM »
Nice Mod / can i have it? :)

Offline Uncle Holden

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #6 on: March 13, 2006, 02:38:48 PM »
I took a few shortcuts when implementing it so it might not be very extensible. If more people are interested I will write a step-by-step guide. Otherwise I can send you my "before" and "after" files and let you figure out what I have changed.

For the demo above, note that it also includes another MOD. Clicking on the rightmost third of the picture takes you to the next picture, the left third takes you to the previous, and the middle takes you to the page with the thumbs.

Offline webslingers

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #7 on: April 02, 2006, 09:46:49 AM »
Count me as interested! It would be 100% perfect if you could also have a table similar to the "new images" on the front page with selects from the featured section. Once it's all setup, that part should be pretty easy. Care to share?

Thanks

Offline dosensteck

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #8 on: April 08, 2006, 09:28:12 PM »
Ok, i found a simple way

open search.php
find
Code: [Select]
$search_id = array();
Code: [Select]
if (isset($HTTP_POST_VARS['best']) || isset($HTTP_GET_VARS['best'])) {
$best = (isset($HTTP_POST_VARS['best'])) ? intval($HTTP_POST_VARS['best']) : intval($HTTP_GET_VARS['best']);
if ($best) {
  $show_result = 1;
$sql = "SELECT image_id
  FROM ".IMAGES_TABLE."
 WHERE best = 1";
 $result = $site_db->query($sql);
 $ids = "";
 while ($row = $site_db->fetch_array($result)){
  $ids .= $row['image_id'].",";
  }
  $search_id['image_ids'] = trim($ids, ",");
}
}

Add to Images Table 1 field called "best" default 0

Add to some Images best = 1

use /search.php?best=1


very simple and not the best way, but it works.

Offline ManniC

  • Full Member
  • ***
  • Posts: 182
    • View Profile
    • photographic impressions
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #9 on: April 18, 2006, 06:36:37 PM »
It would be great if anyone (Uncle Holden / mavenzi ???? :wink:) would post his solution here with sourcecode.

Thanks in advance :!:
Viele Grüße / Best Regards
Manfred
------------------------------------------------------
photographic impressions powered by mc-com.de[/color][/url][/size]

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #10 on: April 18, 2006, 08:38:14 PM »
I'm also interested in this mod  8)

Offline Uncle Holden

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [MOD REQ] Adding a portfolio/showcase section AKA "Featured Images"
« Reply #11 on: April 19, 2006, 01:14:11 PM »
My solution is essentially a hack, and its only redeeming feature is that it works. I made some ugly changes to /admin/images.php that are not extensible. I would rather wait until I have more time to polish it off and write down the steps, otherwise I will feel guilty for publishing something that may break or may be incompatible with other mods.

For those who want to see my solution, you can download the before and after files from here: http://dtabakov.com/dsplus/m.php?p=featured.zip.

Warning: this will not work "out of the box" because my code is talking to a database table that doesn't exist. In my version it is called 4images_featured and has three attributes: image_id (int 10), image_active (tynyint) and image_hits (int 10). Don't just copy these files over your existing files because you will break things. What I would suggest is running diff on the original files and the modified files and seeing where the changes were made. If you decide to play with this, do so on your own risk. If, on the other hand, something doesn't make sense, let me know and I will try to explain what I was trying to achieve.
« Last Edit: April 19, 2006, 03:25:49 PM by Uncle Holden »