Thumbnail modifications Thumbnail modifications
 

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]

Main Menu

Thumbnail modifications

Started by deiussum, October 03, 2007, 07:51:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

deiussum

I'm not sure if this is the right place to post this or if there are any other similar posts already, but I made a couple of small hacks to my Coppermine 1.4.13 code that I thought might be useful to others.

I recently upgraded my gallery from using 1.4.3 to 1.4.13.  Doing so broke some thumbnails on categories that had no albums directly underneath.  An example might be easier to explain.


Category 1
|
|-- Category 2
     |
     |-- Album 1


In order to display a thumbnail for Category 1, I had gone to the database and entered the pid for the thumbnail I wanted into the 'thumb' field.  This worked fine in 1.4.3, but in 1.4.13 the thumbnail would no longer display for Category 1.

Another hack I made was that I created a few albums that had nothing but keyword-linked photos.  I did that because I typically arrange my photos into albums by date, but I wanted a few "favorites" albums that would contain some of my best photos.  The problem was, these albums would only show the "empty album" thumbnail.  I wanted to be able to select a thumbnail for those as well.  Again, I had to do this by going to the database directly, but the thumbnails still wouldn't show.  My hack simply allows them to show.

Here's the diff of my modified index.php to the original one that came with 1.4.13.


201,204c201
<                                       // deiussum: this stops thumbnails from^M
<                                       // displaying for categories with no^M
<                                       // albums or pictures. NOT what I want.^M
<                                         //$user_thumb = $ident;^M
---
>                                         $user_thumb = $ident;^M
504,505c501
<           // deiussum: Allow linked pictures to be used as a thumbnail^M
<             if ($count > 0 || $alb_thumb['filename']) {^M
---
>             if ($count > 0) {^M
869c865
< ?>^M
---
> ?>
\ No newline at end of file


Now I'll admit that this is just a quick and dirty hack to get it to do what I wanted.  It may not be what is desired for the general case, but I thought I'd share it anyway in case it could be extended into something to be put into the main code base.  (And as an added suggestion maybe an option included that lets you pick thumbnails outside of the album/category with the UI instead of having to go directly to the DB?)