Skip to content

September 23, 2009

1

QikBlogr. WordPress Blog posting from my iPhone

Working on a new iPhone app for snapping pics, blogging and pushing it to my WordPress blog using WP’s built in XMLRPC server. Here is the proof, upped from the phone. Success!

When I started this last night, I had no idea how to post data from Objective-C to the web. I thought the php side was going to be a snap since I have some experience with it, but I hit some snags there too. It appeared that no matter what orientation I snapped a pic, portrait or landscape, it would end up rotated or flipped on the server but look fine in iPhoto etc.

From what I could gather, the browser does not respect the image orientation like iPhoto does. It was no good just rotating the image server side because it has no clue if an image looks right!, so finally after an hour of research, I had enough info to tweak the server side php to read the exif metadata and get the orientation then take the appropriate rotation or flip steps. Oh well, lesson learnt.

Anyway, that’s the hardest part over I think. On to lots of features and enhancement.

php exif code added post-post. My app is not that fancy.

 ...
 
$exif = exif_read_data($urlImage, 0, true);
$oriented = $exif['IFD0']['Orientation'];
 
switch($oriented)
   {
        case 3: // 180 rotate
		$imageRotate = imagerotate($src_img, 180, 0);
        break;
        case 6: // 90 rotate
		$imageRotate = imagerotate($src_img, -90, 0);
        break;
    }
 
imagejpeg($imageRotate, $urlNewImage, 90);
imagedestroy($src_img);
 
...

Yay…

QikBloggr Screen Shot

QikBlogr Screen Shot

Posted from my iPhone 3G using QikBlogr.

Related Posts:

Read more from Personal, iPhone
1 Comment Post a comment

Trackbacks & Pingbacks

  1. ebay sniper

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments