Announcement

#1 2013-02-10 15:19:34

K.S.
Translation Team
2013-02-10
4

Google2Piwigo geotag import

Hello,

I'm trying to import my gallery from Picasa Web Albums to Piwigo using Google2Piwigo and it works ok but I have some suggestions.

1. Web servers are often configured with openbase_dir which will cause PHP Warning:

PHP Warning:  curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set

openbase_dir is good thing and Google2Piwigo probably will work anyway but if display_errors is ON then you'll always get jGrowl error message (because of this warning), which you'll have to close manualy, even if import was successful. It's really annoying if your're trying to import many photos.

I think it's good idea to suppress that warning:

Google2Piwigo/include/functions.inc.php

Code:

diff -rupN orig/Google2Piwigo/include/functions.inc.php new/Google2Piwigo/include/functions.inc.php
--- orig/Google2Piwigo/include/functions.inc.php  2012-08-08 13:00:28.000000000 +0200
+++ new/Google2Piwigo/include/functions.inc.php  2013-02-10 01:11:16.893996816 +0100
@@ -43,7 +43,7 @@ function picasa_wa_download_remote_file(
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-language: en"));
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
-    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+    @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     if (strpos($src, 'https://') !== false)

2. I got many pictures on Picasa Web Albums geotagged directly through website and as I can see Google2Picasa doesn't import that geotags at all. But I really want them so I've created this:

Google2Piwigo/admin/template/import.list_all.tpl

Code:

diff -rupN orig/Google2Piwigo/admin/template/import.list_all.tpl new/Google2Piwigo/admin/template/import.list_all.tpl
--- orig/Google2Piwigo/admin/template/import.list_all.tpl  2012-08-08 13:00:28.000000000 +0200
+++ new/Google2Piwigo/admin/template/import.list_all.tpl  2013-02-10 01:11:16.621996814 +0100
@@ -121,6 +121,7 @@ $(document).ready(function() {
       <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'|@translate}</label>
       <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'|@translate}</label>
       <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|@translate}</label>
+      <label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>
     </p>
     
     <p>

Google2Piwigo/admin/template/import.list_photos.tpl

Code:

diff -rupN orig/Google2Piwigo/admin/template/import.list_photos.tpl new/Google2Piwigo/admin/template/import.list_photos.tpl
--- orig/Google2Piwigo/admin/template/import.list_photos.tpl  2012-08-08 13:00:28.000000000 +0200
+++ new/Google2Piwigo/admin/template/import.list_photos.tpl  2013-02-10 01:11:16.545996813 +0100
@@ -417,6 +417,7 @@ $(document).ready(function() {
       <label><input type="checkbox" name="fill_tags" checked="checked"> {'Tags'|@translate}</label>
       <label><input type="checkbox" name="fill_taken" checked="checked"> {'Creation date'|@translate}</label>
       <label><input type="checkbox" name="fill_description" checked="checked"> {'Description'|@translate}</label>
+      <label><input type="checkbox" name="fill_geotag" checked="checked"> {'Geolocalization'|@translate}</label>
     </p>
 
     <p>

Google2Piwigo/include/ws_functions.inc.php

Code:

diff -rupN orig/Google2Piwigo/include/ws_functions.inc.php new/Google2Piwigo/include/ws_functions.inc.php
--- orig/Google2Piwigo/include/ws_functions.inc.php  2013-01-05 14:17:32.000000000 +0100
+++ new/Google2Piwigo/include/ws_functions.inc.php  2013-02-10 21:27:13.570784018 +0100
@@ -67,6 +67,12 @@ function ws_images_addPicasa($params, &$
     'tags' => $photoEntry->mediagroup->keywords->text,
     'timestamp' => substr($photoEntry->gphotoTimestamp->text, 0, -3),
     );
+  $latlon = $picasa->getPhotoEntry($query)->getGeoRssWhere();
+  if ($latlon instanceof Zend_Gdata_Geo_Extension_GeoRssWhere) {
+    $photo['latlon'] = $latlon->getPoint()->getPos()->getText();
+  } else {
+    $photo['latlon'] = "";
+  }
   $photo['path'] = PICASA_WA_CACHE . 'picasa-'.$photo['id'].'.'.get_extension($photo['url']);
   
   file_put_contents('dump.txt', print_r($photo, true), FILE_APPEND);
@@ -130,6 +136,13 @@ SELECT id FROM '.CATEGORIES_TABLE.'
     if (in_array('fill_taken', $params['fills']))       $updates['date_creation'] = date('Y-m-d H:i:s', $photo['timestamp']);
     if (in_array('fill_author', $params['fills']))      $updates['author'] = pwg_db_real_escape_string($photo['author']);
     if (in_array('fill_description', $params['fills'])) $updates['comment'] = pwg_db_real_escape_string($photo['description']);
+    if (in_array('fill_geotag', $params['fills'])) {
+        $latlon = explode(" ", $photo['latlon']);
+        if ( count($latlon) == 2 ) {
+            $updates['lat'] = pwg_db_real_escape_string($latlon[0]);
+            $updates['lon'] = pwg_db_real_escape_string($latlon[1]);
+        }
+    }
     
     if (count($updates))
     {

Maybe this could be done in other way, better or faster but it works for me. Tell me what you think.

3. Finally, few translation changes:
Google2Piwigo/language/pl_PL/plugin.lang.php

Code:

diff -rupN orig/Google2Piwigo/language/pl_PL/plugin.lang.php new/Google2Piwigo/language/pl_PL/plugin.lang.php
--- orig/Google2Piwigo/language/pl_PL/plugin.lang.php  2013-02-10 11:36:59.178404174 +0100
+++ new/Google2Piwigo/language/pl_PL/plugin.lang.php  2013-02-10 14:19:23.898508698 +0100
@@ -21,14 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
 $lang['%d albums'] = '%d albumy';
-$lang['%d pictures are not displayed because already existing in the database.'] = '%d zdjęcia nie są wyświetlane ponieważ znajdu';
+$lang['%d pictures are not displayed because already existing in the database.'] = '%d zdjęcia nie są wyświetlane ponieważ znajdują się już w bazie';
 $lang['%d pictures imported'] = '%d zdjęć zaimportowanych';
 $lang['(%d photos)'] = '(%d zdjęć)';
 $lang['Begin transfer'] = 'Rozpocznij transfer';
 $lang['Fill these fields from Google datas'] = 'Wypełnij te pola danymi z Google';
 $lang['Import all my pictures'] = 'Importuj wszystkie moje zdjęcia';
 $lang['Import all photos in this album'] = 'Importuj wszystkie zdjęcia z tego albumu';
-$lang['Import options'] = 'Importuj opcje';
+$lang['Import options'] = 'Opcje importu';
 $lang['List my albums'] = 'Wyświetl albumy';
 $lang['List pictures of this album'] = 'Wyświetl zdjęcia z tego albumu';
 $lang['No download method available'] = 'Niedostępna żadna metoda pobierania';
@@ -37,4 +37,10 @@ $lang['Open Google page in a new tab'] =
 $lang['Processing...'] = 'Przetwarzanie...';
 $lang['Reproduce Google albums'] = 'Odbuduj albumy Google';
 $lang['Successfully logued to you Google account'] = 'Udane logowanie do Google';
-?>
\ Brak znaku nowej linii na końcu pliku
+$lang['Geolocalization'] = 'Geolokalizacja';
+$lang['API not authenticated'] = 'API nieuwierzytelnione';
+$lang['Photo "%s" imported'] = 'Zdjęcie "%s" zaimportowane';
+$lang['Logged out'] = 'Wylogowany';
+$lang['%d elements ready for importation'] = '%d elementów gotowych do importu';
+?>
+

Last edited by K.S. (2013-02-10 21:28:50)

Offline

 

#2 2013-02-10 15:36:29

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6777

Re: Google2Piwigo geotag import

K.S. wrote:

........
3. Finally, few translation changes:
Google2Piwigo/language/pl_PL/plugin.lang.php

Code:

diff -rupN orig/Google2Piwigo/language/pl_PL/plugin.lang.php new/Google2Piwigo/language/pl_PL/plugin.lang.php
--- orig/Google2Piwigo/language/pl_PL/plugin.lang.php  2013-02-10 11:36:59.178404174 +0100
+++ new/Google2Piwigo/language/pl_PL/plugin.lang.php  2013-02-10 14:19:23.898508698 +0100
@@ -21,14 +21,14 @@
 // | USA.                                                                  |
 // +-----------------------------------------------------------------------+
 $lang['%d albums'] = '%d albumy';
-$lang['%d pictures are not displayed because already existing in the database.'] = '%d zdjęcia nie są wyświetlane ponieważ znajdu';
+$lang['%d pictures are not displayed because already existing in the database.'] = '%d zdjęcia nie są wyświetlane ponieważ znajdują się już w bazie';
 $lang['%d pictures imported'] = '%d zdjęć zaimportowanych';
 $lang['(%d photos)'] = '(%d zdjęć)';
 $lang['Begin transfer'] = 'Rozpocznij transfer';
 $lang['Fill these fields from Google datas'] = 'Wypełnij te pola danymi z Google';
 $lang['Import all my pictures'] = 'Importuj wszystkie moje zdjęcia';
 $lang['Import all photos in this album'] = 'Importuj wszystkie zdjęcia z tego albumu';
-$lang['Import options'] = 'Importuj opcje';
+$lang['Import options'] = 'Opcje importu';
 $lang['List my albums'] = 'Wyświetl albumy';
 $lang['List pictures of this album'] = 'Wyświetl zdjęcia z tego albumu';
 $lang['No download method available'] = 'Niedostępna żadna metoda pobierania';
@@ -37,4 +37,10 @@ $lang['Open Google page in a new tab'] =
 $lang['Processing...'] = 'Przetwarzanie...';
 $lang['Reproduce Google albums'] = 'Odbuduj albumy Google';
 $lang['Successfully logued to you Google account'] = 'Udane logowanie do Google';
-?>
\ Brak znaku nowej linii na końcu pliku
+$lang['Geolocalization'] = 'Geolokalizacja';
+$lang['API not authenticated'] = 'API nieuwierzytelnione';
+$lang['Photo "%s" imported'] = 'Zdjęcie "%s" zaimportowane';
+$lang['Logged out'] = 'Wylogowany';
+$lang['%d elements ready for importation'] = '%d elementów gotowych do importu';
+?>
+

Hi :-)

http://piwigo.org/translate/edit.php?la … gle2piwigo

Can you update in translate tool (login with EN login forum
I open right for you


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2013-02-10 15:49:46

K.S.
Translation Team
2013-02-10
4

Re: Google2Piwigo geotag import

Hi,
Thanks for quick response. Translations are updated.

Offline

 

#4 2013-02-10 15:54:21

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6777

Re: Google2Piwigo geotag import

Thanks :-)

[Subversion] r20646

can you translate also help file
http://piwigo.org/translate/edit.php?la … .lang.html

Clic on 'view reference file' top-right to see EN help


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#5 2013-02-10 16:11:30

K.S.
Translation Team
2013-02-10
4

Re: Google2Piwigo geotag import

Done.

Offline

 

#6 2013-02-10 16:15:21

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6777

Re: Google2Piwigo geotag import

Thanks :-)

[Subversion] r20647

(if you see other error translation in piwigo you can update, if you've time I open other extension no translate to PL)


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#7 2013-02-10 17:32:43

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3271

Re: Google2Piwigo geotag import

"lat" and "lon" fields are added by RV Maps&Earth right ?

Offline

 

#8 2013-02-10 17:49:04

K.S.
Translation Team
2013-02-10
4

Re: Google2Piwigo geotag import

Hmm, it's possible. I got that extension too and just saw there are NULLed "lat" and "lon" in database so I used them. Now I see, if these fields are added by RV Maps&Earth my patch may be "not compatible" with others.

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact