Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2 3   Go Down

Author Topic: How to use custom thumbnails  (Read 32849 times)

0 Members and 1 Guest are viewing this topic.

omniscientdeveloper

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 901
How to use custom thumbnails
« on: May 28, 2004, 08:29:35 am »

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.brownfloyd.com%2Ffiles%2Fcust_thmb.gif&hash=29a66357a2d8c7c0725ffae3ef0986c5dfd7fb61)
Order of thumbnails:
Thumbnails are selected by level (user-defined, theme-defined, global) then by type (file-specific, extension-specific, media-specific) in order. User-defined thumbnails are stored in the folder where the file is located. Theme-defined thumbnails are stored in the themes 'images' folder. Global thumbnails are stored within the 'images' folder of the Coppermine root. Thumbnails can be either a 'gif', 'png', or 'jpg'.
     
Types of thumbnails:
File-specific thumbnails must have the same base name as the file. Using the example in the screenshot, its thumbnails could be 'thumb_thailand_waterfall.gif', 'thumb_thailand_waterfall.png', or 'thumb_thailand_waterfall.jpg', chosen in that order.

Extension-specific thumbnails are named after the extension of the file. (Examples: 'thumb_wmv.jpg', 'thumb_wav.jpg'.)

The base name for media-specific thumbnails are 'thumb_movie', 'thumb_document', and 'thumb_audio'. Images use file-specific thumbnails by default.

Uploading:
There are 2 ways to upload custom thumbnails:
     
1. Have an image already uploaded then upload a video via the upload page. (or vice versa) The video will share the thumbnail of the image.
     
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.brownfloyd.com%2Ffiles%2Fcust_thmb_3.gif&hash=9b9842a3048282ccb39baf48ef6d77b661213c2e)

2. FTP upload both the video and (thumbnail or image) then batch-add. If you FTP upload the thumbnail, the thumbnail will be shown instead of the default Coppermine thumbnail on the batch-add page. If you upload an image it will look like the screenshot. However, when the two files are added, the thumbnail of the image will be used by the video.
     
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.brownfloyd.com%2Ffiles%2Fcust_thmb_final.gif&hash=eb9afbf798bf5ecc7566a6c4682ff7e5c51cbfef)
Final result.

Note: If methods 1 is used and the image is deleted, the thumbnail will be deleted also, and the default Coppermine thumbnails will be used. If a previous video has be uploaded via FTP, the thumbnail must be uploaded via FTP to the same folder.

Video uploads are available for cpg1.3.0 (or better) as part of the distribution and for cpg1.2.1 as separate modification. Custom thumbnails aren't supported in versions prior to 1.3.0. Using these instructions, a custom thumbnail can be applied to any file, not just videos.


FAQS:
  • Quote
    I have a video named 'movie.wmv', when I upload a thumbnail for it 'thumb_movie.jpg' it replaces multiple videos!!!! ??? :\'(
    Duhh. 'thumb_movie.jpg' is a media-specific thumbnail. Rename the video and the thumbnail to something other than just 'movie'.
  • Quote
    I can't find my user's folder!
    From within Coppermine, browse to the user's album. Look in the url of your browser and you should see the folder's name. (See screenshot for an example.)
    (https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.brownfloyd.com%2Ffiles%2Fuser_folder_link.gif&hash=e5d75cd4387bbb71a25dafd9a69cb17a01934c1e)
    Your users can upload their own thumbnails by using this trick: Create an album. Change the permissions on it so no one can view it except him. Then upload the fullsize images of the thumbnails to this folder. Files outside this album will be able to use the thumbnails of these images. (See above for naming.)
  • Quote
    How do I stop my users from creating their own custom thumbnails?
    Right now, you can't.
« Last Edit: January 01, 2005, 08:11:32 pm by GauGau »
Logged

marx

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: How to use custom thumbnails
« Reply #1 on: June 21, 2004, 09:46:32 pm »

I get this error when i try to add custom thumbs to a couple of flash files

Warning: getimagesize(albums/broken%20innocense/thumb_broken002.jpg): failed to open stream: No such file or directory in /var/www/html/index.php on line 456


the flash file name is broken002.swf so this should work and I ftpthe thumbs and swfs together and then batch added them, in the admin mode they show up but not in user mode.is this a bug or am I doing something wrong? it seems this problem only appears with flash files with movie files I have no problems

my host runs  PHP Version 4.3.4  and MySQL 3.23.58


« Last Edit: June 21, 2004, 10:10:20 pm by marx »
Logged

omniscientdeveloper

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 901
Re: How to use custom thumbnails
« Reply #2 on: June 22, 2004, 02:53:24 am »

Is the thumbnail actually named "thumb_broken002.jpg" (case-sensitive). Also, try removing the space from the directory name. I have no problem with flash file thumbs. In effect, there's nothing different between a flash thumb and a movie thumb, so if you're not having a problem with those, you shouldn't with this.


-omni
Logged

marx

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: How to use custom thumbnails
« Reply #3 on: June 22, 2004, 11:51:01 pm »

removed the space and it worked,thanks for your help
Logged

azPNG

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 9
  • PNGResource Admin
    • PNGResource.com
Re: How to use custom thumbnails
« Reply #4 on: July 05, 2004, 05:09:44 pm »

Aight.  I need to know how to do this so I can explain to my members how to do this.  But unfortunately, I DO NOT understand the instructions above.  Can you please post a clear understand of Step 1, 2, 3 so on and so forth.  It is so unclear.  Thanks
Logged

geneticfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Video thumbnails
« Reply #5 on: July 05, 2004, 06:16:38 pm »

I've been able to get custom thumbnails to work for video, but they only show in the category view. In the album view, only the generic wmv thumbnail is shown.

I'm using 1.3 integrated with Invision Board 1.3

Category view: http://www.eastcoaster.com/gallery/index.php?cat=4
Album view: http://www.eastcoaster.com/gallery/thumbnails.php?album=34
Logged

omniscientdeveloper

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 901
Re: How to use custom thumbnails
« Reply #6 on: July 06, 2004, 12:35:06 am »

I have no idea how you managed to get thumbnails with an extension of "wmv" to show without editting the code.  :-\\
(Please explain this, so if there is a bug I can fix it.)

All you have to do to use a custom thumbnail is upload an "image" with the same name. Make sure both are lowercase.

For example:

X.jpg for X.wmv
ttdrpm.jpg for ttdrpm.wmv


-omni
Logged

geneticfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: How to use custom thumbnails
« Reply #7 on: July 06, 2004, 02:05:34 am »

I honestly don't know either ???. They were originally .jpg and I just changed the extension. It just seemed to work for the category view. I've tried it by just uploading a jpg file, but it never picked it up. I'm on the verge of deleting my Coppermine installation and re-installing it, because it just seems a little buggy all around. The only modification I did to it other than integrating it with my Invision Board was this one that allows Coppermine to mimic the default Invision skin.
Logged

omniscientdeveloper

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 901
Re: How to use custom thumbnails
« Reply #8 on: July 06, 2004, 03:19:20 am »

First, make sure you have the copy from the stable branch of CVS. Once you have this, run the update.php script. If you've already done this....


If your video ISN'T in a userpics subfolder, you'll have to upload the thumbnail via FTP to the folder that the video is in named "thumb_"+ your filename + image extension (jpg/png/ or gif).

....So...For your X.wmv video you'll upload an image named:

thumb_X.jpg (note the caps)


This is only if you've uploaded the videos via FTP. If you uploaded them via the upload page, you should be able to do it as previously stated.


Quote
I honestly don't know either

If this patch that you speak of had you edit the functions.inc.php file, then that's probably the reason why you can have "wmv" extensions. I'll have to test this later.



-omni
Logged

geneticfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: How to use custom thumbnails
« Reply #9 on: July 06, 2004, 04:15:31 am »

I've tried uploading a file like thumb_X.jpg, but it just doesn't seem to pick it up. The other site that I have Coppermine on works just like it is supposed to. I've added a custom thumb just by uploading it to the same directory via FTP after the video was already loaded, and also when uploading them at the same time. Like I said, I think a clean install might solve this and the other problems I'm having. Fortunatley, they are mostly a pain on my end, and the site is still functional without having to rush to get it fixed.

There were three edits to functions.inc.php:

Quote
Step  2:  Open ../cpg/include/functions.inc.php

  A. Find

/**************************************************************************
   Function for managing cookie saved user profile  


     Insert above the blue code



//-- mod_coppermine begin
    define('IS_IPB', true);
   
    // ------------------------------------------------------------//
    //  User Configuration                                         //
    // ------------------------------------------------------------//
    //  Define the path to your ipb.                               //
    //  You can use a relative path from your Coppermie directory  //
    //  Do not use an url                                          //
    //  Example: ../ipb13/index.php                                //
    // ------------------------------------------------------------//
    define('IB_PATH', "../ipb13/index.php");
   
    define('COPPERMINE', true);
   
    if (defined('IS_IPB')) {
   
        // ------------------------------------------------------------//
        //  User Configuration                                         //
        // ------------------------------------------------------------//
        //  Translation of ipb language id to coppermine lang names    //
        // ------------------------------------------------------------//
        $ipb_lang = array('en' => "english", '2' => "german", '3' => "french");
       
        global $HTTP_GET_VARS;
        if (isset($HTTP_GET_VARS['set_lang']) and isset($HTTP_GET_VARS['lang']) ) {
            $HTTP_GET_VARS['lang'] = $ipb_lang[$HTTP_GET_VARS['lang']];
        }
        require (IB_PATH);
        ipb_style();
    }
//-- mod_coppermine end


/**************************************************************************
   Function for managing cookie saved user profile  


  B. Find in function load_template(..)

        $template = fread(fopen($template_file, 'r'), filesize($template_file));  


     Insert above the blue code



//-- mod_coppermine begin
        if (defined('IS_IPB')) {
            global $content;
            if (!empty($content)) {
                $template = $content;
                $template = str_replace("<% COPPERMINE JAVASCRIPT %>",
                                        "<script type=\"text/javascript\" src=\"scripts.js\"></script>",
                                        $template);
            }
        }
        if (!defined('IS_IPB'))
//-- mod_coppermine end


        $template = fread(fopen($template_file, 'r'), filesize($template_file));  


  C. Find in function display_film_strip(..)

?>  


     Insert above the blue code



//-- mod_coppermine begin

function ipb_style(){
    global $content;
   

$styles_array = array(  
                'ul' => "ul {margin-left: 5px; padding: 0px;}",
                'li' => "li {margin-left: 10px;margin-top: 4px;margin-bottom: 4px;padding: 0px;list-style-position: outside;list-style-type: disc;}",
                'a' => "a {text-decoration: none;}\na:hover {text-decoration: underline;}",
                'bblink' => "bblink a {text-decoration: none;}\nbblink a:hover {text-decoration: underline;}",
                '.tableh1' => ".tableh1 {padding-top: 3px;padding-right: 10px;padding-bottom: 3px;padding-left: 10px;}",
                '.tableh1_compact' => ".tableh1_compact {padding-top: 2px;padding-right: 5px;padding-bottom: 2px;padding-left: 5px;}",
                '.tableh2' => ".tableh2 {padding-top: 3px;padding-right: 10px;padding-bottom: 3px;padding-left: 10px;}",
                '.tableh2_compact' => ".tableh2_compact {padding-top: 2px;padding-right: 5px;padding-bottom: 2px;padding-left: 5px;}",
                '.tableb' => ".tableb {padding-top: 3px;padding-right: 10px;padding-bottom: 3px;padding-left: 10px;}",
                '.tableb_compact' => ".tableb_compact {padding-top: 2px;padding-right: 5px;padding-bottom: 2px;padding-left: 5px;}",
                '.tablef' => ".tablef {padding-top: 10px;padding-right: 10px;padding-bottom: 10px;padding-left: 10px;}",
                '.thumb_title' => ".thumb_title {font-weight : bold;padding: 2px;display : block;}",
                '.thumb_caption' => ".thumb_caption {padding: 1px;display : block;}\n.thumb_caption a {text-decoration: underline;}",
                '.thumb_num_comments' => ".thumb_num_comments {font-weight: normal;padding: 2px;font-style : italic;display : block;}",
                '.user_thumb_infobox' => ".user_thumb_infobox {margin-top: 1px;margin-bottom: 1px;}\n".
                                        ".user_thumb_infobox th {font-weight : bold;margin-top: 1px;margin-bottom: 1px;text-align : center;}\n.user_thumb_infobox td {margin-top: 1px;margin-bottom: 1px;text-align : center;}".
                                        ".user_thumb_infobox a {text-decoration: none;}\n".
                                        ".user_thumb_infobox a:hover {text-decoration: underline;}",
                '.sortorder_cell' => ".sortorder_cell {padding: 0px;margin: 0px;}",
                '.sortorder_options' => ".sortorder_options {padding: 0px;margin: 0px;font-weight: normal;white-space: nowrap;}",
                '.navmenu' =>    ".navmenu {font-weight: bold;border-style: none;}\n".
                                ".navmenu img {margin-top: 1px;margin-right: 5px;margin-bottom: 1px;margin-left: 5px;}\n".
                                ".navmenu a {position: relative;display: block;padding-top: 2px;padding-right: 5px;padding-bottom: 2px;padding-left: 5px;text-decoration: none;}\n".
                                ".navmenu a:hover {text-decoration: none;}",
                '.admin_menu_thumb' => ".admin_menu_thumb {border: 1px solid #005D8C;background-position : bottom;font-weight: bold;margin-top: 0px;margin-bottom: 0px;}\n".
                                      ".admin_menu_thumb a {text-decoration: none;display: block;position: relative;padding-top: 1px;padding-bottom: 1px;padding-left: 3px;padding-right: 3px;}\n".
                                      ".admin_menu_thumb a:hover {text-decoration: underline;}",
                '.admin_menu' => "admin_menu {border: 1px solid #005D8C;background-position : bottom;margin-top: 0px;margin-bottom: 0px;text-align: center;}\n".
                                ".admin_menu a {text-decoration: none;display: block;position: relative;padding-top: 1px;padding-bottom: 1px;padding-left: 3px;padding-right: 3px;}\n".
                                ".admin_menu a:hover {text-decoration: underline;}",
                '.comment_date' => ".comment_date {vertical-align : middle;}",
                '.image' => ".image {border-style: solid;border-width:1px;border-color: #000000;margin: 2px;}",
                '.thumbnails' => ".thumbnails {padding: 5px;}",
                '.alblink' =>    ".alblink a {text-decoration: underline;}\n".
                                ".alblink a:hover {text-decoration: underline;}",
                '.catlink' =>    ".catlink {display: block;margin-bottom: 2px;}\n".
                                ".catlink a {text-decoration: underline;}\n".
                                ".catlink a:hover {text-decoration: underline;}",
                '.topmenu' =>    ".topmenu {line-height : 130%;}\n".
                                ".topmenu a {text-decoration : none;}\n".
                                ".topmenu a:hover  {text-decoration : underline;}",
                '.img_caption_table' =>  ".img_caption_table {border: none;width : 100%;margin : 0px;}\n".
                                        ".img_caption_table th {padding-top: 4px;padding-right: 10px;padding-bottom: 4px;padding-left: 10px;}\n".
                                        ".img_caption_table td {padding-top: 6px;padding-right: 10px;padding-bottom: 6px;padding-left: 10px;}",
                );
    $replace_array = array( array(".codebuttons", ".button, .comment_button"),
                            array(".tablepad", ".album_stats"),
                            array(".checkbox", ".radio, .listbox"),
                            array("#photoimg", ".thumbcaption"),
                            array("img.attach", ".thumbnails"),
                          );

    for ($i = 0; $i < count($replace_array); $i++) {
        $pattern = $replace_array[$i][0];
        if (substr($pattern,0,1) == ".") {
            $pattern = "\\".$pattern;
        }
        $pattern = "`".$pattern."`i";
        $content = preg_replace($pattern, $replace_array[$i][0].", ".$replace_array[$i][1], $content);
    }
    if (count($styles_array) ) {
        arsort($styles_array);
        foreach ($styles_array as $key => $style) {
            if (substr($key,0,1) == ".") {
                $key = "\\".$key;
            }
            $pattern = "`^".$key."`";
            if (!preg_match($pattern, $content) ) {
                $content = str_replace("</style>", "\n".$style."\n</style>", $content);
            }
        }
    }
}

//-- mod_coppermine end


?>  
Logged

omniscientdeveloper

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 901
Re: How to use custom thumbnails
« Reply #10 on: July 06, 2004, 05:59:20 am »

Yea. Do a clean install. It doesn't look like the code modifies the thumbnail generation functions, but it's possible, that you could've modified something unknowingly.


-omni
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to use custom thumbnails
« Reply #11 on: July 06, 2004, 08:32:00 am »

The only modification I did to it other than integrating it with my Invision Board was this one that allows Coppermine to mimic the default Invision skin.
This is a third party modification that is based on cpg1.2.1 code and will for sure mess up your whole cpg1.3.0 install (making it "buggy" on the way). The use of this mod "Coppermine Goes Invisionboard" is not recommended with cpg1.3.0 (in fact, it's not recommended at all). Imo all your problems come form the usage of this "mod", which is more of a hack, as it messes with coppermine core code.

GauGau
Logged

blowndeadline

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: How to use custom thumbnails
« Reply #12 on: July 15, 2004, 08:16:09 am »

Ok, I have upgraded my coppermine gallery to the latest version that supports video. I do really appreciate this addition to Coppermine by the way! Great work.
I tested a swf file by uploading the following file:
car1.swf
I also created a screenshot of the file for the thumb called:
thumb_car1.jpg

The thumb is displayed and when clicked, the gallery page with the swf file is on it and plays just fine.
Just so I know, anyone that uploads a swf file must also upload a thumb_file.jpg that matches the original swf file's name correct?
There is no way to automatically generate a thumb from a swf file, or at least from what I know.
If this is correct just let me know. I have currently created a post explaining the entire swf file upload procedure so everyone will know this.
But, now I have to go through 100 swf files and get screenshots of them all when I batch add :\'(, I'll get over that, just glad there isn't 500 swf files!

You can take a look at my Coppermine gallery in action by visiting http://swiftdev.com/gallery2.php
Let me know what you think!
Thanks again for the great improvements to Coppermine!
Mike
Swiftdev
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to use custom thumbnails
« Reply #13 on: July 15, 2004, 04:42:56 pm »

There is no way to automatically generate a thumb from a swf file, or at least from what I know.
You're right, the image libraries Coppermine can use (either GD or ImageMagick) don't come with flash file support, they can only work with "regular" image file types; that's why there can't be a creation of thumbnails "on the fly".

GauGau
Logged

blowndeadline

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: How to use custom thumbnails
« Reply #14 on: July 15, 2004, 11:50:12 pm »

Thanks GauGau, that's what I wanted to know!
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: How to use custom thumbnails
« Reply #15 on: August 07, 2004, 11:31:17 am »

I just installed a clean 1.3.1 and I can't use custom thumbs. It only uses the default thumb_avi.jpg
File name: http://titooy.free.fr/test/albums/2003/joonhwan/20030718/DSCF0358.AVI
Thumb name: http://titooy.free.fr/test/albums/2003/joonhwan/20030718/thumb_DSCF0358.JPG (I tried with .jpg and .gif and it doesn't work either)

What did I do wrong?
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: How to use custom thumbnails
« Reply #16 on: August 07, 2004, 12:09:50 pm »

Just a shot in the dark, try changing the extenion of the JPG to lower case, jpg.
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: How to use custom thumbnails
« Reply #18 on: August 07, 2004, 02:16:46 pm »

The problem is solved when I change .AVI to .avi and .JPG to .jpg

How can I make Coppermine to deal with .AVI too?

Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: How to use custom thumbnails
« Reply #19 on: August 07, 2004, 03:09:13 pm »

I've changed
Code: [Select]
               $thumb_extensions = Array('.gif','.png','.jpg');into
Code: [Select]
               $thumb_extensions = Array('.gif','.png','.jpg','.GIF','.PNG','.JPG');in order to make it accept upper-case extension for the thumbs

but I don't know php enough to modify
Code: [Select]
                $file_base_name = str_replace('.'.$mime_content['extension'],'',basename($pic_row['filename']));in order to make it delete the upper-case extensions aswell
Logged
Pages: [1] 2 3   Go Up
 

Page created in 0.035 seconds with 19 queries.