forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Αndré on June 22, 2009, 12:20:23 pm

Title: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 22, 2009, 12:20:23 pm
Upload custom thumbnails for your pictures and files (videos, documents, audio files, etc.). It will display a new button under the file in the intermediate/displayimage.php view. Thumbnails will be automatically downsized.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on December 30, 2009, 11:02:58 am
Version 1.2 currently has English and German output.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: François Keller on December 30, 2009, 12:29:31 pm
french lang file attached
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on December 30, 2009, 01:55:18 pm
Thanks. Added to svn.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Timos-Welt on March 09, 2010, 10:53:33 am
Upload of thumbs doesn't work ATM with installed SEF_URL plugin. So uninstall SEF plugin before uploading custom thumbs. Afterwards you may install it again.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on March 12, 2010, 02:11:31 pm
Version 1.6 visually integrates to the new file menu (buttonlist).
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: baldwinkam on May 12, 2010, 12:31:17 pm
hi everyone, i'm new here, just wondering what does it mean " It will display a new button under the file in the intermediate/displayimage.php view"?

do i just need to upolad the whole "custom thumb" folder to the plugin folder?
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on May 12, 2010, 01:07:43 pm
http://documentation.coppermine-gallery.net/en/plugins.htm
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Mister Hahn on June 09, 2010, 02:43:29 am
Hi! I would like to ask: is there any chance that you might support the creation of "normal_" thumbnail and keeping the original version of the uploaded image as well, alongside the "thumb_" that is currently created by your plugin?

It occurs to me that using this plugin in combination with Flash Media Player, FMP uses the thumbnail produced by Custom Thumbnail. But it's always way too small compared to player dimensions and when the image is enlarged by FMP the result is ugly to see. I presume this can be workarounded increasing the thumbnail size setting in the coppermine configuration, but then it would be awful to navigate through albums and categories.

Having thumb_ and normal_ it'd be possible to navigate through albums and categories diplaying the smallest thumbnail (which is right for that task) and to set the FMP to use the intermediate or full preview image to be displayed inside the player (which i think it'd be more eye-candy for that task).

Anyway, thanks for creating this =)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 09, 2010, 08:07:40 am
What you are asking is possible. But if you'd create normal_ files, you have to adjust the FMP plugin to use that file. That is not a straightforward solution.

Instead, open codebase.php, find
Code: [Select]
resize_image($thumb, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);and replace $CONFIG['thumb_width'] with your desired picture size.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Mister Hahn on June 15, 2010, 01:09:57 am
Hi Andrè, thanks for your advice.
The resizing part is ok, now i can have uniform AND custom size for thumbnails customized with this plugin.
However, there's still a layout problem: for any size that is reasonable for a video-preview thumbnail (400-500px), although browsing through gallery pages is fine because actual thumbnails get downscaled with height and width arguments of <img> tag, the filmstrip in the displayimage.php page you can browse next and previous videos with is unusable, because it displays full-size thumbnails (as specified replacing $CONFIG['thumb_width']), and this leads to no more than one thumbnail displayed correctly instead of 5, which are displayed cut.

Any more advice?

Thanks anyway =)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 15, 2010, 08:28:53 am
Feel free to modify the plugin, so it creates regular thumbnails and a video thumbnail (e.g. prefix 'video_') at the same time (and adjust FMP to use the big file as preview).

Second possibility: adjust the film strip code to downscale thumbnails as well or disable the film strip.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: olaechea on June 17, 2010, 10:31:20 pm
demo or screenshot please
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Joachim Müller on June 18, 2010, 08:45:09 am
Your gallery is your demo. Respect board rules if you want supporters to look into your suggestions.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 18, 2010, 10:05:57 am
demo or screenshot please
Not sure what you expect, but here is a picture of the button ::)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cl9m on June 30, 2010, 09:03:51 am
Hi!

I've a probleme with the watermark on custom thumbnail for video.
When I Upload a custom thumb for a video I've the thumb but no watermark.

yet everything is ok in my main configuration.

Is it possible that the problem comes from this plugin?

Anyway, thanks for creating this§
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 30, 2010, 09:39:13 am
As far as I can see, Coppermine doesn't watermark thumbnails, so why should the plugin does? Correct me if I'm wrong.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cl9m on June 30, 2010, 10:15:31 am
It's new in Coppermine 1.5
config > Displaying images > watermarking option (only in cpg1.5.x)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 30, 2010, 10:45:59 am
Not sure what you are talking about. config > Displaying images > watermarking option doesn't exist in cpg1.5.x.

At Configuration → Image watermarking → Which files to watermark you cannot select thumbnails, but pnly original, intermediate files or both. If you upload pictures to your gallery, there won't be a watermark on them. So where's the benefit of having watermarked custom thumbnails, but for pictures you'll have thumbnails without a watermark?
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Joachim Müller on June 30, 2010, 01:06:31 pm
I've a probleme with the watermark on custom thumbnail for video.
When I Upload a custom thumb for a video I've the thumb but no watermark.
That's not a feature of this plugin nor is it a feature of Coppermine? Why would you want a watermark on a thumbnail? A watermark on intermediates or full-sized images makes sense, but it doesn't make sense on thumbnails. If you want your custom thumbs watermarked, watermark them on your client before you upload them. The entire discussion is beyond the scope of this plugin announcement thread though imo and should be lead elsewhere (if at all).
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cl9m on June 30, 2010, 03:13:00 pm
ok sorry, I am wrong.
If I want watermark on thumbnails it's just differing picture thumb and movie thumb
I used watermark for put a icon movie on other file as picture.

(sorry for my english) :-\
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on June 30, 2010, 03:22:11 pm
I used watermark for put a icon movie on other file as picture.
That's of course a feature request for this plugin.

If a user uploads a custom thumbnail for a movie we could add a film strip overlay to the thumb. I currently do this client-sided (before I upload that thumbnail). But we have to consider different video dimensions (4:3, 16:10, 16:9, etc.).
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cl9m on July 01, 2010, 03:00:30 pm
ok thanks for your answers.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cavok on November 30, 2010, 12:06:28 pm
I use Custom Thumbnail plugin as recommended with plugin Flash Media Player plugin with visual integration (play flv/mp4/mp3/aac files) (http://forum.coppermine-gallery.net/index.php/topic,62704.0.html), but when I view the video page /coppermine/displayimage.php, after the video (when an automatic start) is the thumbnail that appears in large format.
So the quality is really bad. Can not we create an intermediate image of better quality?

Thank's
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on November 30, 2010, 02:46:08 pm
Open codebase.php, find
Code: [Select]
resize_image($thumb, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']);and replace with
Code: [Select]
$resize_method = $CONFIG['picture_use'] == "thumb" ? ($CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use']) : $CONFIG['picture_use'];
resize_image($thumb, $thumb, $CONFIG['picture_width'], $CONFIG['thumb_method'], $resize_method);
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cavok on December 17, 2010, 02:52:02 pm
The image to replace the video in the page /coppermine/displayimage.php, at the end of the video
with this modification is of good quality now.

But unfortunately, now in the FilmStrip is a great image that appears, and is less well.
But perhaps this new problem is generated by other change Film strip - Overlap Thumbails (http://forum.coppermine-gallery.net/index.php/topic,68450.msg340187.html#msg340187)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on December 17, 2010, 03:08:02 pm
In that case you'll have to do more things.

I assume you're using unmodified versions of the both plugins.

First you have to modify the Custom Thumbnail plugin to create a thumbnail and an intermediate-sized image. Then you have to modify the Flash Media Player plugin to use the intermediate-sized image as preview image for the video.

Please give me some time and I'll release new packages of both plugins. I don't know if I find some time this weekend, but I think I'll solve it this year ;)
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on December 22, 2010, 03:50:38 pm
Version 1.7 (attached to initial post) has a new option to create an additional intermediate-sized picture. It's now also compatible with the sef_url plugin.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: cavok on December 23, 2010, 08:26:51 pm
Thank you, works perfectly with Flash Media Player plugin with a new option to create intermediate picture.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: shortmort37 on December 30, 2010, 03:47:32 pm
Αndré,

I love this mod - it works great.

This was discussed in another thread, but - it would be really cool if, in addition to being able to assign a custom thumbnail to a video or file, you could also do so to a category.  e.g., I have a category for my Plymouth Gallery for the Sport Fury model, and categories underneath for individuals owning that model, with their albums under that.  I'd like to show a stylized thumbnail for the category, as in the attachment.

Perhaps if I knew how difficult that might be, I wouldn't even post the suggestion!  But I'm out of my depth in terms of doing it myself.  Just thought I'd ask!

Thanks
Dan
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: shortmort37 on December 30, 2010, 03:50:33 pm
I'd like to show a stylized thumbnail for the category, as in the attachment.

Oops!  Sans attachment.  I also neglected to add:  I'd like for the thumbnail to not be constrainted to already be in any set underneath it.  With that constraint, it must also exist within an album that is exposed to all users, and I'd prefer not to create an album with category icons only.

Thanks
Dan
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on December 30, 2010, 04:15:22 pm
shortmort37, that's not what this plugin was designed for. It's only a user-friendly interface for the already built-in mechanism of custom thumbnails. I don't know exactly what we discussed in the thread you mentioned, but I think what you tried to do isn't possible by default. Please start a new thread in the plugins board or in the feature requests board if you want to be able to do what you want to do in the future.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: shortmort37 on December 31, 2010, 03:25:21 am
OK - done.

http://forum.coppermine-gallery.net/index.php/topic,69438.0.html

Thanks
Dan
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Templarart on January 20, 2011, 04:37:16 pm
Great plugin - exactly what I needed.  Here's a quick question/problem.  Do the dimensions of the new thumb have to stay the same as the dimensions of the old thumb?  I just tried replacing a tall, rectangular thumb with a square thumb and the square thumb was squished horizontally to the dimensions of the old thumb's tall rectangle.  Is this just unavoidable or am I doing something wrong?  Thanks.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on January 20, 2011, 04:50:40 pm
The thumbnail will always be resized to the values you specified in Coppermine's config. At least this is how the plugin should work by design.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Templarart on January 21, 2011, 04:01:11 pm
"The thumbnail will always be resized to the values you specified in Coppermine's config. At least this is how the plugin should work by design."

Right, that's a given - let's say 120 on the longest side.  What I'm wondering about is the proportions.  As I look at the thumbs in my gallery I see squares (120x120), long rectangles (120xwhatever) and tall rectangles (whateverx120).  I was trying to substitute a square (120x120) for a tall rectangle (70x120).  When I uploaded a square thumb (120x120), it was squished into the proportions of the original thumb (70x120).  If this is unavoidable... oh well, but I was hoping it was just a mistake I was making.

Thank you for your prompt reply.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on January 21, 2011, 04:16:07 pm
Please post a link to your gallery, especially to a thumbnail which doesn't have the correct size after you updated it with the plugin.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Alu on April 18, 2011, 11:12:28 am
Is there a way to prevent it from converting it to .jpg if I upload .png?
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on April 18, 2011, 03:18:52 pm
Is there a way to prevent it from converting it to .jpg if I upload .png?

Open codebase.php, find
Code: [Select]
                if (!is_image($row['filename'])) {
                    $path_parts = pathinfo($row['filename']);
                    $row['filename'] = str_replace($row['filename'], basename($row['filename'], '.'.$path_parts['extension']).'.jpg', $row['filename']);
                }
and replace with
Code: [Select]
                if (!is_image($row['filename'])) {
                    $imginfo = cpg_getimagesize($fileupload['tmp_name']);
                    switch ($imginfo[2]) {
                        case '1': $extension = '.gif'; break;
                        case '3': $extension = '.png'; break;
                        default:  $extension = '.jpg'; break;
                    }
                    $path_parts = pathinfo($row['filename']);
                    $row['filename'] = str_replace($row['filename'], basename($row['filename'], '.'.$path_parts['extension']).$extension, $row['filename']);
                }

Note: it only works if you upload a custom thumbnail for non-images, as Coppermine assumes the same file type for images and their thumbnails. Additionally if you upload more than one custom thumbnail for the same file (with different extensions) more than one thumbnail for the same file may exists. In that case the standard routine of detecting custom thumbnails applies (GIF -> PNG -> JPG).
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: WillyWonderDog on August 25, 2014, 06:32:23 pm
Plugin works great. Thank you.  Of course I have a question though, what is the proper way to remove a custom thumbnail? I see how to change the custom thumbnail if desired by uploading a new image for it, but I can't figure out how to properly remove a custom thumbnail (and let it go back to the system thumbnail).
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: Αndré on August 25, 2014, 07:59:20 pm
The "official" way is to delete the thumbnail file via FTP. I personally never needed that option, but I can of course add it to the plugin if you like. It might be tricky if there's a picture file with the same base name. In this case we either need to move the file to another location, where no file with the same base name exist. Alternatively we need to hide that option for such files. I added it to my to-do list.
Title: Re: Custom Thumbnail for cpg1.5.x
Post by: WillyWonderDog on August 26, 2014, 01:25:51 am
Put it WAY down on your todo list. From a home PC, I run a small family-only website that includes CPG and can just delete the custom thumbnail in a file manager. In the rare cases when a member wants to remove a custom thumbnail, I will have them request me to delete it.  I don't allow FTP into my home PC anymore because it was constantly being hammered by the script kiddies. BTW, 6 of the 7 plugins I use have been authored by you, Thank you.