Location Data Google Photos API - google-api

When I query a photo in Google photos via the API, it doesn't return any location data that is associated with the image. I can see the location on the map when I view the information about the image in Google Photos, however the API doesn't give me these coordinates.
[mediaMetadata] => Google_Service_PhotosLibrary_MediaMetadata Object
(
[creationTime] => 2018-07-13T13:20:38Z
[height] => 4032
[photoType:protected] => Google_Service_PhotosLibrary_Photo
[photoDataType:protected] =>
[videoType:protected] => Google_Service_PhotosLibrary_Video
[videoDataType:protected] =>
[width] => 3024
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
[photo] => Google_Service_PhotosLibrary_Photo Object
(
[apertureFNumber] => 1.8
[cameraMake] => Apple
[cameraModel] => iPhone 8
[exposureTime] =>
[focalLength] => 3.99
[isoEquivalent] => 50
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
)

It appears that Google has no intention of sharing photos location.
The location field used to appear in the MediaMetadata fields as "Not yet available", but any reference in the Google Photos API, after release, was removed except for the docs about downloading an image, where it's stated: "If you want to download the image retaining all the EXIF metadata except the location metadata, concatenate the base URL with the d parameter".

Even though the PHP wrapper for this class includes the location fields it appears that the Google API is not currently populating this object. In the documentation for the mediaItems resource the field location states "Not yet available".
You can use the Google Drive API to get the location data though of a photo.
There is a ticket raised to track this feature implementation.

I agree that it looks like Google don't want to provide this.
You can star this bug in their tracker to upvote the issue https://issuetracker.google.com/issues/80379228 but it has not yet got any response from Google.

I solved that by using Google Drive sync. See my Android Application: https://play.google.com/store/apps/details?id=com.levionsoftware.photo_map_for_google_photos
My App has been approved and works very well, but it's annoying that they don't open the door. In many cases it wouldn't work as I did. And at the end it's only a workaround...
EDIT: Some are having problems with that, because not all photos are synced to Google Drive...

Related

Sending ics/ical emails via Laravel 8

I am working on a laravel app and I would like to send meeting/calendar invites that go directly to the users calendar. For example, how calendly does it. The invite should automatically appear on the recipients calendars. Currently I have been able to attach them to the email, but not send directly. This may just be something I missed in the Laravel Mail docs and need to send this exact file instead of an email, but not as an attachment. I cannot seem to figure out how to do this either.
I currently looked around stackoverflow and did not find a clean implementation of this for laravel despite it being a pretty common feature. I have tried Spatie, Eluceo, and INSAN packages on github and did not have much luck. The code below works for downloading a .ics file.
I would appreciate any helpful comments! I have spent a long time looking into this already with little progress.
use INSAN\ICS;
$properities = [
'uid' => uniqid(),
'sequence' => 0,
'description' => 'Event Invitation via email.',
'dtstart' => date('2021-05-01 09:00'),
'dtend' => date('2021-05-01 10:00'),
'summary' => 'This is an event invitation sent through email.',
'location' => 'VR Punjab, S.A.S Nagar, Chandigarh',
'url' => 'www.example.com',
];
$ics_file = new ICS($properities);
return $ics_file->toString();

Facebook adgroup creation - Invalid parameter

I am having an issue promoting an unpublished page post via the ads-api.
This was previously working ok for me, but began causing problems yesterday.
I first create an ad_campaign, and then, using the returned campaign_id, I attempt to create an adgroup.
The response from the server is
array(1) {
'error' =>
array(3) {
'message' =>
string(53) "(#100) Invalid parameter: adgroup_spec["campaign_id"]"
'type' =>
string(14) "OAuthException"
'code' => int(100)
}
}
I have verified that I am sending over the correct, newly created campaign_id.
Another point of interest; when I use the UI to delete the ad_campaign afterwards, I am told that I do not have permission to do so. User XXXX does not have permission to access campaign YYYY.
I'm thinking this must be an access_token/permission issue but I'm stumped. The ad objects are created using the user's token, and the unpublished page post is created using the page's access token.
NB: I can provide snippets if needs be, but I'm fairly sure this is a problem with the object creation flow as opposed to a code issue.
Has anyone seen anything similar?
Cheers, Gary
Update with POST data
array(7) {
'campaign_id' =>
int(6013621027457)
'bid_type' =>
int(6)
'bid_info' =>
string(37) "{"clicks":10,"reach":10,"actions":80}"
'conversion_specs' =>
string(66) "{"action.type":"offsite_conversion","offsite_pixel":6013619180457}"
'creative' =>
string(86) "{"type":27,"object_id":407012979370770,"auto_update":false,"story_id":565852233486843}"
'name' =>
string(23) "PropelAd (via PropelAd)"
'targeting' =>
string(95) "{"countries":["IE","AE","GB"],"friends_of_connections":[407012979370770],"page_types":["feed"]}"
}
Yes, it happens to me as well from time to time when uploading ads.
It's very statistical, and it seems to be an off-sync between Facebook servers (the campaign was already successfully uploaded, but the ad-request-handler does not recognize that id).
Wait a few seconds, and try again - after a few shots, it will always work (usually there's no problem, it's pretty rare but happens - and never lasted more than a minute of not-recognizing).
Perhaps it happened more today, due to the general Facebook failures.
I can only assume/hope that Facebook keep track of these errors, and are working on minimizing them by syncing their servers better.
Yep - we are currently putting a lot of time in checking why do ad group fail on unpublished posts - specifically on posts scheduled in the future.
The behavior is very inconsistent. The errors we get are slightly different: "Could not save ad", "Invalid ad creative". The errors are not reported on all ad groups but mostly on one of the ad groups of a whole batch.
We do make sure that the campaign start time is equal or AFTER the time the post is scheduled to.
When we publish the post now and test with the same campaign structure it succeeds (although this also succeeds sometimes on the second try - like it was mentioned here, that the campaign takes some time maybe to become fully valid)
A related bug I opened is here:
https://developers.facebook.com/bugs/593878450648811?browse=external_tasks_search_results_52662e53c59bd2e63625449

Post in Google+ stream is not showing up in user's stream using google-api-PHP-client

I'm trying to post in a user's Google+ stream, and I'm trying it using the google-api PHP client. Until now, I've been able of configure a test environment using the latest google-api PHP client and an example script (See 401 Unauthorized access when posting Google+ Moments with PHP Client for more information). It looks like it posts, because it returns an array with the answer, but nothing shows up in the user stream.
The answer array is:
Array (
[kind] => plus#moment
[type] => http://schemas.google.com/AddActivity
[target] => Array (
[kind] => plus#itemScope
[url] => https://developers.google.com/+/plugins/snippet/examples/thing
)
[result] => Array (
[kind] => plus#itemScope
)
[id] => xxxxxxxxx
)
which looks correct. Does anyone know why this is happens and how to solve it? Thank you!
App activities do not render in the user's stream but instead render in the app activities section of Google+ here:
https://plus.google.com/apps/
To prevent spam in the stream, the user must explicitly share to their stream in Google+. You can do this using Shares and Interactive Posts.

CakePHP when using uploadedit validation, save fails

Okay, so I am uploading documents when a user registers on my site, I collect some personal information and save it. Now I have had a bit of a problem, I split up the main registration form into a couple of view, where the user once logged in can now edit certain information, like for example one field called personal_introduction. For some reason this wont save, even though there are no validation errors on the field. Messed around in the model, to try pick up the problem and fount THIS causes the problem:
'document_file' => array(
'checkuploadedit' =>array(
'rule' => array('checkUpload', false),
'message' => 'Please select your document.',
),
'checkuploadedit' => array(
'rule' => array('extension', array('doc', 'docx', 'txt', 'rtf')),
'message' => 'File extentions allowed: .doc .docx .txt .rtf - we do NOT accept pdf format.'
)
),
Once I remove this from my model, it saves the data. Now its weird for me that the main registration form gives no problems, and that this view that does not even contain a form input called "document_file" fails the save.
Any ideas...Please!!! Obviously I need to validate the upload.
I tried this: validation on a input file in cakephp , thinking that maybe the above code is not correct, still no luck.
Thanks in advance for your answers.
Cheers Louis.
I went on to further investigate the problem, and found the following, which I still cant explain. When submitting views that do not contain the upload form on the same model, it still tries to validate the upload form, I could actually see the value for one as if submitted, even though it was not. so the only solution I got was to go use unset($this->data['user']['document']) for the actions which do not have the document upload form field. Hope this makes sense.

how to link to webmail providers based on email address?

I'd like to link my users directly to the appropriate webmail provider, based on their email addresses (e.g. link my "#gmail.com" users to Gmail). Is there a standard way of doing this? Preferably a Ruby gem. I don't mind being the one to make it--but I don't want to duplicate effort if it exists and I just haven't found it.
This is related to How do I identify a webmail service from an email address?.
You could do some gross redirection based on the mail box's hostname's DNS MX record.
e.g.
$mx = array();
getmxrr('gmail.com', $mx)
should return something like
Array
(
[0] => alt2.gmail-smtp-in.l.google.com
[1] => alt1.gmail-smtp-in.l.google.com
[2] => gmail-smtp-in.l.google.com
[3] => alt4.gmail-smtp-in.l.google.com
[4] => alt3.gmail-smtp-in.l.google.com
)
From which you could identify who the provider is. But that presumes they're not hiding their name via further aliases and whatnot.

Resources