YamdaBlam!

Archive for July, 2010

Getting GPS Data out of your images

by Jay on Jul.21, 2010, under PHP, jQuery

Privacy is important

Your privacy is a big deal. Be it in the physical world or in the virtual world. The unfortunate thing is that because browsing the web can be done in solitude, personal privacy tends to be an after thought. Not too mention that nearly everybody in the western world has access to an internet connected device.

When you take a photo on one of the latest digital cameras, or from a smart phone and if the device has GPS functionality, it can be assumed that the photo has been tagged with the location of where it was taken. This information is stored in a data format call EXIF. You can read all about it here and here.

It is not a huge leap of the imagination that if your photos are published on the internet ( which is public and not private ) that you are enabling others to track your movements without your expressed informed consent. This information can be used against you aswell as for you. The question should arise of how to manage your online profile. I will cover this topic in a later post.

GPS Data

Photo location is encoded using the Global Positioning System. This is a network of satellites orbiting the globe which return positions of devices which request it.  If you would like to know more about this see here.

Do your uploaded photos hold GPS data?

There are loads of web apps out there that will answer this question for you. In the spirit of DIY and because I like to program, I decided to put together my own image information parsing system. You can see it in action here. This basically reads the EXIF data from an image supplied via a URL to the image in question.

Next steps…

As you see from the lab, the system generates a link to the search page on http://maps.google.com/ When time permits, I will add a Google Mapping feature which will display the position from the image on a Google map. Watch this space.

Demo

This little web app is built using the ExifReader.php class from quiteless.com. You can get it here. It is an elegant PHP class which is now part of my library. Thank you Steve! (quiteless.com)

As always, feedback and comments are more than welcome!

Enjoy!

Leave a Comment :, , , , , , more...

Cannot use object of type stdClass as array

by Jay on Jul.19, 2010, under PHP, Technology

Problem

I was getting this particular error when decoding JSON data block from a web service.

It basically is trying to assert that the data block is a different type to the variable which it is being assigned to.

Meet solution

Explore the data dump by using something like

echo ‘<pre>’;  print_r($dataDump); echo ‘</pre>’;

and you will see the different data types for example:

stdClass Object ( [acc] => Array ….

Drill down through the structure to the data you want and check the data type of it. To prevent this error, simply apply some Type casting during the variable assignment. Bada-bing… problem, meet solution.

1 Comment :, , , , , , more...

URL Shortening on your site

by Jay on Jul.15, 2010, under API, PHP, Technology, jQuery

A nice feature to have on a site would be that of a URL shortener. I’ve looked at some of the more popular ones and decided to play with the API of the most popular, http://bit.ly.

I selected bit.ly as it is the most widely used, your account can be integrated with your Twitter client (Twitter for iPhone for example) and most impressively, you can get real time statistics on the shortened URL’s you create. This would be very useful for those companies who wish to track their marketing campaigns running on their website/twitter/Facebook accounts.

In the spirit of exploration, I’ve created a simple PHP bit.ly class, called bitlyApi.class.php.

To get up and running with this, I first created a new bit.ly account and copied out the API key they provide. Once you create an account, you will have access to the realtime statistics feature, otherwise you’ll just get the bog standard URL shortener service.

The bit.ly API is really straight forward. Have a look at the previous link to see what you can do.

Taking the most obvious function, URL shortening, the class simply takes in a valid URL, puts together the API request and sends it along with my username and API key and in return a JSON encoded string.

Download the sample code and have a look here at the live demo.

Note, that the code supplied is not production ready. I would need to have your usual input validation etc..

Feel free to comment!

Leave a Comment :, , , more...

Recall on the cards for iPhone 4

by Jay on Jul.13, 2010, under Technology

It doesn’t surprise me. Apple has not been performing well for me  or some friends lately.

Shortly after its release, punters started reporting the problem. Apple denied it.

Then a memo was release informing employees how to handle complaints about it. A.k.a damage control.

Now Consumer Reports has done a u-turn and is not recommending the phone until Apple put a permanent and free fix in place.

Ouch.

How does Apple respond? Why, it deletes discussion reports on the contentious issue. Job well done. (Excuse the pun!)

So, is a recall on the cards? Some say it is ‘inevitable’.

I’m not impressed with Apple of late. I own a iPhone 3G and had recently updated the OS to iOS4 and have had nothing but problems since doing so. The same problems have been reported by my wife and she is due to downgrade the OS like I did yesterday. By the way, if you want to do this too for similar reasons, here is a great tutorial from the folks over at Lifehacker.com

Since downgrading, the problems (network connection loss, unresponsiveness) have ceased to be an issue. I am now running OS3.1.2 and all is good!! Looks like 3G does not have the hardware spec to handle the new features which iOS4 has to offer. Or, on the other hand, maybe some lazy coding is the reason. I would say both.

Since buying a Macbook last year, I’ve bought a number of other Apple products and this is the first time having serious problems with their stuff. Get the act together Apple!

- Update: 15th july

Looks like Apple will be holding a press conference on the matter on the 16th to address the issue.

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

 

Archives

All entries, chronologically...