Bug in Geo Datenübernahme

Phoca Gallery - image gallery extension
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in Geo Datenübernahme

Post by Jan »

Hallo, dann muss das Problem irgendwo anders sein - wenn "echos" es gut darstellen, dann muss auch Phoca Gallery es gut darstellen. Die "echos" sind direkt hinter der Variable - so was in "echo" dargestellt ist, ist auch in Variable gesetzt.

So, was mir einfällt, ist: z.B. ein System Plugin ändert Output, oder Javascript ändert Output - ob ja, und warum und wie, leider keine Ahnung. Das gleiche, was echo ausschreibt, muss auch in Variable, die dann dargestellt wird, gespeichert. :idea:

Jan
If you find Phoca extensions useful, please support the project
Hauptstadtboy
Phoca Member
Phoca Member
Posts: 16
Joined: 14 Mar 2016, 12:55

Re: Bug in Geo Datenübernahme

Post by Hauptstadtboy »

Hello Jan,

Do jou have an idea, waht the problem coud be?
Is there any way for me to assist yout with debugging of other code variables?

Remenber: The ECHO that i Put in the code, did show the same Geo Data as the filds in the EXIF Pane.
I still have the Problem that mostly (not always!) the World Icon is not visible in Category wiews - even if there are geo informations in the EXIF Data present. (and are correct from my piont of view)

It all works fine if i put in the geo Data manually with the map in each data record. But: even with correct Geo informations in EXIF Data the positions are not transfered to the Record: menaning i see zeros (0) for the corordiantes and the zoom factor.

There must be a function that converts the the Geo Informations to deciamal values - my echos in the code show the data like exif in degrees. Is it possible, that this conversion fails - ore in other words: were do the three zeros in the data record come from?

The map to search for the geo Position always starts from the "Earth view" - so i have to zoom in and turn the earth more and more to find the position. Other geo setting software remembers the last position at this point, because of assuming that the next positionton search is nearby the last position.

Regards
Mikel from Berlin
(have nice easter days..)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in Geo Datenübernahme

Post by Jan »

Hi, the geo icon is displayed in case, there is longitude and latitude for the image ( if there is empty longitude or latitude value, the icon will be not displayed)

The Zoom needs to be set in edit of image - in Phoca Gallery administration

See the geo function - this function tries to get information from the image and tries to store it when image is added to system (to display the map):

administrator\components\com_phocagallery\libraries\phocagallery\geo\geo.php

So maybe there you can find some more info :idea:

Jan
If you find Phoca extensions useful, please support the project
Hauptstadtboy
Phoca Member
Phoca Member
Posts: 16
Joined: 14 Mar 2016, 12:55

Re: Bug in Geo Datenübernahme

Post by Hauptstadtboy »

Hi Jan,
i was trying to find out from where the zeros in the Data come from. For this i addes 3 echo statements in the code if the geo.php.

Code: Select all

$lat = $long = '';
		$fileOriginal = PhocaGalleryFile::getFileOriginal($filename);
echo $fileOriginal ;
echo $filename;
and

Code: Select all

// Not happy but @ must be added because of different warnings returned by exif functions - can break multiple upload
		$exif 		= @exif_read_data($fileOriginal, 0, true);
echo $exif;
Then i added an image with exif Data into the Gallery with the "New" Button (normally i use the mutiple upload) but i never saw any Output from the echo statemants anywhere im my Browser Window. It looks like the function is never called, but after hitting the "save" button, the zeros are present in the data fields.

As i am not so familiar with the code: should i have got any message or output there???

I understand what the functions are doing, but have no idea, at what time and why they are executed. Like

Code: Select all

if (!function_exists('exif_read_data')) {
		return array('latitude' => 0, 'longitude' => 0);
I understand: make zeros, if exif_red-data does not exist - but i have no idea, from where the "exif_read_data" shold come from...



regards
Mikel from Berlin
(thank you so much for the time you invest in my questions!)
Hauptstadtboy
Phoca Member
Phoca Member
Posts: 16
Joined: 14 Mar 2016, 12:55

Re: Bug in Geo Datenübernahme

Post by Hauptstadtboy »

Hi Jan, Hallo Benno,

I figured out, what the problem is!

Code: Select all

if (!function_exists('exif_read_data')) {
		return array('latitude' => 0, 'longitude' => 0);
	} else {
		//if (JFile::getExt($fileOriginal) != 'jpg') {
		//return array('latitude' => 0, 'longitude' => 0);
		}
		
The Problem is that i use normally capital endings like "JPG" but the Code compares "jpg" . So all images with the small Endings have the Geo Data visible, while Filies with capital Ending do not.

As You see in the code, i have commented out the two lines that do that. The result is that both file endings are interpreted correctly. I have no Idea at this time, how to code this snipped better. I do also not know, what happens. if am image is not jpg or JPG at all.

If You have an Idea, what the correct code for that snipped is: please let me know!!

Unfortunately i have to make new Versions of the images in Phoca Gallery : deleting the old record an then import the image once again... :evil:

Besondere Grüße an Benno!!!!


Regards,
Mikel from Berlin
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in Geo Datenübernahme

Post by Jan »

Hi, thank you very much for the info. Please test the following code:

Code: Select all

if (!function_exists('exif_read_data')) {
      return array('latitude' => 0, 'longitude' => 0);
   } else {
      if (strtolower(JFile::getExt($fileOriginal)) != 'jpg') {
      return array('latitude' => 0, 'longitude' => 0);
      }

And let me know if it works for you (the code translates all the extension to small caps, so everything like JPG, jpg, jPG, etc. will be checked. This should work for you.

Please let me know, if this will work OK, I will change it in next version.

Thank you, Jan
If you find Phoca extensions useful, please support the project
Hauptstadtboy
Phoca Member
Phoca Member
Posts: 16
Joined: 14 Mar 2016, 12:55

Re: Bug in Geo Datenübernahme

Post by Hauptstadtboy »

Hi Jan,

it works fine with large caps - and this was the problem! I did not test the result, when the filename is already in small caps.

By the way: in
/J3/administrator/components/com_phocagallery/libraries/phocagallery/utils
i changed

Code: Select all

// =============================
$params['geozoom']		= 15;
$params['youtubeheight']		= 360;
$params['youtubewidth']		= 480;
// =============================
the zoom factor to 15. is there really no way to set this in the general settings? (maybe i am blind - sometimes)
So i only have to clear the three zeros in the database, and then hit save. After that i have correct Geo informations with a zoom of 15 (which is fine for me)

Thanks fur Your kind help to find the Bug!


Regards
Mikel :D
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Bug in Geo Datenübernahme

Post by Jan »

Hi, no, this needs to be customized. There is limited count of parameters possible in a component (to not overload the system) and there can be thousands of possible parameters, so not every possible value is set to parameters :idea:

Jan
If you find Phoca extensions useful, please support the project
Post Reply