Jump to content
TNG Community
Sign in to follow this  
jayat1familytree

modify admin_generatethumbs

Recommended Posts

jayat1familytree    0
jayat1familytree

I would like to modify the generate thumbs process to use specific thumbnails for 3 of the media collections; headstones, newspapers and obituaries.

Having a thumbnail of the exact image is unnecessary because any detail is indistinguishable at that size. 

Using a "global" generic image would save space and reduce the total number of file count on a shared server.

And the kewl trick is that the mouse rollover will still display a popup of the actual image!

 

But I am struggling exactly where to insert code and the syntax of the code needed to accomplish this.

 

I am thinking that at about line 79 before it starts on the

            }            if( function_exists( imageJpeg ) && image_createThumb( $path, $newthumbpath, $thumbmaxw, $thumbmaxh, $thumbquality ) ) {

to insert a set of else if like this; (snippet starts about line 69)

  ------------------------------------------------------------

  if( $newthumbpath ) {
        //$cleanfile = $session_charset == "UTF-8" ? utf8_decode($row['path']) : $row['path'];
        //$cleanpath = "$rootpath$usefolder/" . $cleanfile;
        $path = "$rootpath$usefolder/" . trim($row['path']);
        if( file_exists( $path ) ) {
            if( ceil( filesize( $path )/1000 ) > $maxsizeallowed ) {
                $needsupdate = 0;
                $conflicts++;
                $conflictstr .= $row['path'] . " " . $admtext['thumbsize'] . "<br />\n";  //file is too big
            }
            else {
                
    elseif( $row['path'] LIKE 'headstones%') {
    t_headstones.gif
    
    }
    elseif( $row['path'] LIKE 'obituaries%') {
    t_obituaries.gif
    
    }
    elseif( $row['path'] LIKE 'newspapers%') {
    t_newspapers.gif
    
    }    
            }            if( function_exists( imageJpeg ) && image_createThumb( $path, $newthumbpath, $thumbmaxw, $thumbmaxh, $thumbquality ) ) {
                    $destInfo  = pathinfo( $newthumbpath );
                    if( strtoupper( $destInfo['extension'] ) == "GIF") {
                        $thumbpath = substr_replace( $thumbpath, 'jpg', -3 );
                        $newthumbpath = substr_replace( $newthumbpath, 'jpg', -3 );
                    }
                    @chmod( $newthumbpath, 0644 );
                    $count++;
                }
                else {
                    $needsupdate = 0;
                    $conflicts++;
                    $conflictstr .= $newthumbpath . " " . $admtext['thumbinv'] . "<br />\n";  //thumb couldn't be created
                }
            }
        }
        else {
            $needsupdate = 0;
            $conflicts++;
            $conflictstr .= $row['path'] . " " . $admtext['thumblost'] . "<br />\n";  //original doesn't exist
        }
    }
    if( $needsupdate ) {
        $changedate = date ("Y-m-d H:i:s", time() + ( 3600 * $time_offset ) );
        $query = "UPDATE $media_table SET thumbpath=\"$thumbpath\", changedate=\"$changedate\", changedby=\"$currentuser\" WHERE mediaID=\"{$row['mediaID']}\"";
        $result2 = mysql_query($query) or die ($admtext['cannotexecutequery'] . ": $query");
        $updated++;
    }

-----------------------------------------------

I am hoping someone out there will be able to help me find the right code.

Thanks in advance for any help.

Jay

 

 

 

 

Share this post


Link to post
Share on other sites
Martin J Mosley    0
Martin J Mosley

Hi Jay,

I've been doing the for some time, though I'm not bright enough to automate the process.

Basically I have a small group of thumbnail images, and I specify which one I need each time I add a new media item.. The same thumb is used many times, with the advantages you mention.

If it is possible to automate the process, then I'd be very interested to learn how.

Share this post


Link to post
Share on other sites
jayat1familytree    0
jayat1familytree

Martin,

After I upload a gedcom and go thru the 'create thumbnails" then I go into myphpadmin and run this set of SQL queries to adjust the media

To set the thumbs to a GLOBAL generic;

UPDATE tng_media SET `thumbpath` = '_thumbs/t_census_icon.png' WHERE `mediatypeID` = 'census';
UPDATE tng_media SET `thumbpath` = '_thumbs/t_obituaries.gif' WHERE `mediatypeID` = 'obituaries';
UPDATE tng_media SET `thumbpath` = '_thumbs/t_newspapers.gif' WHERE `mediatypeID` = 'newspapers';

To set the video to standard size for all video items;

UPDATE tng_media SET `width` = '560' WHERE `mediatypeID` = 'videos';
UPDATE tng_media SET `height` = '360' WHERE `mediatypeID` = 'videos';

to set GLOBAL thumb images for certain FORM types;

UPDATE tng_media SET `thumbpath` = '_thumbs/t_pdf.gif' WHERE `form` = 'pdf';
UPDATE tng_media SET `thumbpath` = 'recordings/_thumbs/t_mp3.gif' WHERE `form` = 'MP3';
UPDATE tng_media SET `thumbpath` = 'img/_thumbs/t_video.png' WHERE `form` = 'FLV';
UPDATE tng_media SET `thumbpath` = 'videos/_thumbs/t_mp4.png' WHERE `form` = 'MP4';
UPDATE tng_media SET `thumbpath` = 'videos/_thumbs/t_avi.png' WHERE `form` = 'AVI';
UPDATE tng_media SET `thumbpath` = '_thumbs/t_worddoc.gif' WHERE `form` = 'DOC';

Just FYI

Jay

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×