Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How to define images as "frontpage highlights" ?  (Read 2959 times)

0 Members and 1 Guest are viewing this topic.

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
How to define images as "frontpage highlights" ?
« on: March 22, 2009, 07:25:34 pm »

I have a coppermine gallery that I want to feed images into a custom module on my homepage. It will first be pulling from the last uploads functionality, but I would like to take it a step further and selectively define images to be included in this last uploads list. So, for example - I upload 10 images to the site. Right now, all 10 would be eligible to be displayed in the last uploads feature. I would like to modify the file data for the 10 images and selectively flag 4 of the 10 that should be showcased. Now it will search through the last uploads (by date) and only pull from the 4 flagged.

I can create this feature if it doesn't already exist. I've not seen it so far in my searches, but I wanted to check here first. Perhaps there is another way to achieve this without hacking the system? Maybe I can use a custom keyword field as the check? If the keyword exists or says "highlight" I will pull from it? Any help is appreciated.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to define images as "frontpage highlights" ?
« Reply #1 on: March 23, 2009, 10:01:06 am »

So basically you're trying to display content taken from Coppermine on non-coppermine-driven pages? That's what we call content syndication - there's an entire mod board dedicated to mods that deal with that sort of hacks. The devs team recommends using cpmFetch. To flag particular records, you'd have to add database fields and come up with corresponding user interface code, which will require some skills. This is a bit beyond what you can expect from regular support. As a workaround, you might (ab)use the keyword feature - that's what I do on my personal gallery: I use keywords that nobody would enter to create "meta-albums" that I can search for. Assigning a keyword like "Holiday2009AprilFranceParisChampsElysees" to 8 out of 10 pics in an album will give you the power to use that as meta album (search result).
Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: How to define images as "frontpage highlights" ?
« Reply #2 on: March 25, 2009, 10:33:34 pm »

I ended up using the keyword feature and wrote some custom PHP code that dips into the coppermine and displays the most recent 4 items tagged with the specific keyword in user4 column. Works like a charm.
Logged

Fabricio Ferrero

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 1996
  • From San Juan, Argentina, to the World!
    • http://fabricioferrero.com/
Re: How to define images as "frontpage highlights" ?
« Reply #3 on: March 25, 2009, 10:59:05 pm »

If you are agree you could share it attaching the file to your next post or creating a new topic explaining what you did and a mod would move to the Mod's and Hacks sub-boards.
Logged
Read Docs and Search the Forum before posting. - Soporte en español
--*--
Fabricio Ferrero's Website

Catching up! :)

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: How to define images as "frontpage highlights" ?
« Reply #4 on: March 30, 2009, 06:46:16 am »

Yes, and I have actually experienced a bug with my fix that has been posted before on this site but I can't seem to locate the solution.

In your configuration setup a custom description field (user1 - user4). Then tag your images that you want to be highlights in the properties with a special keyword in the user description you enabled. I am using user4 and the keyword is "yes" ... So now I construct a string:

http://www.yoururl.com/coppermine/thumbnails.php?album=search&search=yes

The problem I have is that if a user has not previously searched the forum and checked the box for the user4 field to include it in searches then Coppermine returns no results.

My custom code for a homepage module works kind of like this (Joomla using modphp):

Code: [Select]
$database->setQuery("SELECT * FROM cpg140_pictures WHERE user4='yes' '' ORDER BY ctime DESC");
Then I just spit out the results in a little module, showing thumbnails and titles and making them clickable to go right into the gallery.

I have tried to figure out a URL to construct that includes user4 by default to no avail, and I've tried to hack the associated search files without success (yet) to make user4 a default field to search when getting a string from the URL. Any help is appreciated and then I can polish up this post and make it a hack thread.

Logged

radianation

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 79
    • Radianation
Re: How to define images as "frontpage highlights" ?
« Reply #5 on: March 30, 2009, 07:22:02 am »

Ok, in order to make the URL search work I made the following change on the search.init.inc

Code: [Select]
if (!isset($USER['search']['params'])){
        $USER['search']['params']['title'] = $USER['search']['params']['caption'] = $USER['search']['params']['keywords'] = $USER['search']['params']['filename'] = 1;
}

to

Code: [Select]
if (!isset($USER['search']['params'])){
        $USER['search']['params']['title'] = $USER['search']['params']['caption'] = $USER['search']['params']['keywords'] = $USER['search']['params']['filename'] = $USER['search']['params']['user4'] = 1;
}
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.