Google Map in Coppermine Gallery, version 2 (of mod and api) - Page 9 Google Map in Coppermine Gallery, version 2 (of mod and api) - Page 9
 

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

Google Map in Coppermine Gallery, version 2 (of mod and api)

Started by Tranz, May 07, 2006, 10:05:44 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Tranz

It shouldn't be a problem because my database doesn't use cpg_ either. I think the script does a replace on the characters since it knows what prefix you use. So no, you shouldn't edit the prefix in the update.sql file. I don't know what could cause this to fail. Have you done previous updates with Coppermine core files before? Did the database changes "take"?

The only things I can think of was that update.sql wasn't successfully uploaded to the server or update.php wasn't run.

jamesjoyce

I just upgraded to the latest version op Coppermine, ran update.php and verified. Everythin ok. I started again with your modifications and when I run update.php after modifying sql/update.sql I verified via PhpMyAdmin the CPG_config table. No gmap_... to see  ??? I keep looking what can be the problem...

jamesjoyce

OK. I manually executed the sql queries and did all the modifications. Now, I just have to figure out how to work with it  :-[

jamesjoyce

So happy as a child  :D

Still a lot work to do but here are the first results.

One additional problem is that I'll have to convert all my coördinates. Please, make this auto exif reading work  ::)

http://d-eye.be/portfolio/thumbnails.php?album=49

http://www.d-eye.be/portfolio/googlemaps.php

Tranz

Quote from: jamesjoyce on July 31, 2007, 03:23:26 PM
One additional problem is that I'll have to convert all my coördinates. Please, make this auto exif reading work  ::)
My camera doesn't do GPS so I can't test things out. Does Coppermine's exif code handle GPS? That's the only way I could think of that this mod could do auto exif because I don't know how to work with it myself.

Please don't roll your eyes at me.

jamesjoyce

Sorry or the eyes...

Probably coppermine doesn't support the gps tags in exif yet. I found this discussion:

http://forum.coppermine-gallery.net/index.php?topic=37439.0

I was misled by a previous post in this tread by someone who wrote a little script...

Thanks again!

pocketmon

Quote from: jamesjoyce on July 31, 2007, 04:58:52 PM
Sorry or the eyes...

Probably coppermine doesn't support the gps tags in exif yet. I found this discussion:

http://forum.coppermine-gallery.net/index.php?topic=37439.0

I was misled by a previous post in this tread by someone who wrote a little script...

Thanks again!

I did make it. Just call the function to get location information in EXIF and pass them to addpic.
Please check.
http://forum.coppermine-gallery.net/index.php?topic=31206.80

pocketmon

Quote from: pocketmon on August 07, 2007, 03:45:36 PM
I did make it. Just call the function to get location information in EXIF and pass them to addpic.
Please check.
http://forum.coppermine-gallery.net/index.php?topic=31206.80

One other fix to GPS information parsing is find in include\makers\gps.php


                     $data = $hour+$minutes/60+$seconds/3600;


replace with

if ( $intel == 1)
{
                                $data = $hour+$minutes/60+$seconds/3600;
                        }
else
{
$data = $seconds+$minutes/60+$hour/3600;
}
       

pocketmon

Here is step by step procedure to make this mod. to support getting GPS information in EXIF.

The procedure here is baed on 1.4.10. I am not sure if it is compatible to later version.

1.Modify GPS EXIF decoding, to support different endian
in  include\makers\gps.php
find code, near line 237

$data = $hour+$minutes/60+$seconds/3600;

change it to

if ( $intel == 1)
{
    $data = $hour+$minutes/60+$seconds/3600;
}
else
{
    $data = $seconds+$minutes/60+$hour/3600;
}


2.Modify to extract GPS information of EXIF when adding new pictures.
in include/picmgmt.inc.php
find code, near line 24

if($CONFIG['read_iptc_data'] ){
        include("include/iptc.inc.php");
}

ADD following code after

include("include/exif.php");


find code, near line 34

    $image = $CONFIG['fullpath'] . $filepath . $filename;
    $normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
    $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;

ADD following code after

    $Latitude='';
    $Longitude='';


Find, 4 lines after previous code

    if (!is_known_filetype($image)) {
        return false;
    } elseif (is_image($filename)) {
        $imagesize = getimagesize($image);



ADD following after

        $exifRawData=read_exif_data_raw($image,0);
        if(is_array($exifRawData['GPS']))
        {
        $Longitude=$exifRawData['GPS']['Longitude'];
        if(strncmp($exifRawData['GPS']['Longitude Reference'],"W",1)==0)
        {
        $Longitude = '-'.$Longitude;
        }
        $Latitude=$exifRawData['GPS']['Latitude'];
        if(strncmp($exifRawData['GPS']['Latitude Reference'],"S",1)==0)
        {
        $Latitude = '-'.$Latitude;
        }
       
        }


Find, near line 130 ( the line count is that before modification)


    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";



MODIFY to

    if($Latitude == '')
    {
    // modified end
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
    //movidifed
    }
    else
    {
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, latitude, longitude) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$Latitude}', '{$Longitude}')";
    }



3. Finish. Try it. Just add your JPEG files embedded with GPS information in any way Coppermine supports.

------------------------------------------------------------------------------------------------
Regarding the way to add GPS information into JPEG, you can try
1. Picasa ( no GPS needed)
2. gpsphoto.pl ( support RAW file)
3. gpsphotoLink (for Mac only)
4. Robogeo

I only have experience with Robogeo, which does great job, except that it didn't support Canon's CRW/CR2 file.

cpgfan67

Hi Tranz,

Marvellous work with regards to your gmap mod, works like an absolute dream :) I followed your instructions and based them on gallery version 1.4.10.  Now in the wake of the recent gallery release (1.4.12) I'd quite like to upgrade. 

I'm assuming that applying the upgrade will overwrite the gmap mod changes made to some of the files with the updated copies of the same files from the 1.4.12 download.  I've kept copies of the 1.4.10 modified files to one side and wondered if it would cause a problem simply uploading these to the appropriate places in the site after uploading the coppermine 1.4.12 files or alternatively not overwriting the modified gmap files?  I've got a mysql dump and site backup to roll back to. 

Apologies if this has already been answered somewhere else.  I had a quick look round and didn't see anthing especially relevant to my question so I thought I'd post here. 

Many thanks!

Tranz

Thanks, I'm glad you like the mod.

Upgrades are the bane of modders everywhere, but they're necessary. :(

What I do to handle updates is to use WinMerge to diff the code.

- First I backup my current directory
- Then I compare the current gallery to the new version and move code over
- If I'm not sure if a code change is core or mod, I will compare the backup of the current with the version that matches the version that is being replaced, in your case, 1.4.10
- It helps to learn the keyboard shortcuts to do this quickly since there are a lot of files to process
- It is a tedious activity so reserve it for a time when you don't mind doing it

Hope that helps.

cpgfan67

Cheers for your prompt reply Tranz :)

As you say, I guess it's gonna take time to work out whether the changes that have been made in 1.4.12 will work with your modifications but then, hey, its taken a whole lot of time to get this far with coppermine so I guess a little more work won't make much difference;)
I'll give the program you suggested a look.  Within the context you mention it in, it certainly looks quite useful.  I'll give it a go and see what happens, I hope the next release isn't to close ;) Cheers!  

cpgfan67

Just thought I'd post an update on my last post. 

The program you suggested (Winmerge) was really useful and helped highlight the changes between my current modified coppermine files and the new 1.4.12 release.  Moving code over from the modified 1.4.10 files was a doddle and I managed not to overwrite anything important to the 1.4.12 release. All seems to work well as far as I can see. :)

snark

Hi,

I've not followed up the changes to this mod, so sorry for asking the question: is it possible to select a default view for the map, when assigning a position to the pictures?

Example: in my Venice gallery, I'd like the map to be zoomed on Venice only, while on my London gallery, it should be zoomed by default on London. I guess it should use some setting per album.

Thanks!

Tranz

Could you please clarify what you mean by gallery? Do you mean albums or separate gallery installations?

The map config allows you to set your default center for each installation.

snark

Quote from: TranzNDance on August 16, 2007, 02:24:22 AMCould you please clarify what you mean by gallery? Do you mean albums or separate gallery installations?
Yes, sorry, I meant individual albums.

Quote from: TranzNDance on August 16, 2007, 02:24:22 AMThe map config allows you to set your default center for each installation.
Yes, I found this. But I'd like a default center per album.

Tranz

If thumbnails.php has this:
$center_avg_coords = TRUE;

then you should see the view based on the location of the photos in that album. Are you seeing otherwise? Please post urls.

I think having manual settings per albums would complicate things.

snark

Quote from: TranzNDance on August 16, 2007, 05:10:14 PMAre you seeing otherwise? Please post urls.
I lost the function since I installed the last CPG update, as I didn't save a backup of the modified files :'( .
I'll reimplement the changes in the coming days, test and let you know.

carlo1

autsch :-( something is wrong after installing this mod. i hope someone can help me.
please look at my side and you will see the big big mistake.
http://hoelzlmani.pytalhost.de/cpg141/

at the beginning you will find a lot of text, after this, i can see the gallery. i don´t know what is wrong.
i changed this files:
map.inc.php
german.php
langfallback.inc.php
admin.php
editOnePic.php
editpics.php

also i registered for the api key.
i have one new file called googlemap.php. this is the file i created in replay #2. what i must do with this file?
also i changed the database.

i installed only version 2, i can´t find v1? is this my problem? i can´t find how to install v1.

thank you very much.

carlo1

i reinstall all, but now i have new problems :-(
i changed all files again i wrote before, but i can´t see any changes in my configurations menu, so it is not possible to change the api key.
after klick on a picture i get the wrong api error.

maybe someone can help me. thank you.