{"id":619,"date":"2010-01-23T14:04:36","date_gmt":"2010-01-23T21:04:36","guid":{"rendered":"http:\/\/www.threshold-zero.com\/cblog\/?p=619"},"modified":"2010-01-23T14:04:36","modified_gmt":"2010-01-23T21:04:36","slug":"integrating-picasa-web-photos-with-wordpress","status":"publish","type":"post","link":"https:\/\/www.threshold-zero.com\/cblog\/2010\/01\/integrating-picasa-web-photos-with-wordpress\/","title":{"rendered":"Integrating Picasa Web Photos with WordPress"},"content":{"rendered":"<p>OMG is this so much harder than it needs to be.<\/p>\n<p>Picasa (or Google) offers nothing in the way of little blog widgets (unlike Flickr&#8217;s great support for everything), nor is there really any third-party support for this kind of thing out on the web.<\/p>\n<p>I don&#8217;t understand why, since &#8212; at least to me &#8212; what Picasa offers for free is so much better than what Flickr offers, still, even to this day. :<\/p>\n<p>Every third-party WordPress plugin I&#8217;ve tried either doesn&#8217;t work, doesn&#8217;t work right, or needs so much configuration on the server side &#8212; and I&#8217;m talking about editing raw PHP here (unacceptable) or creating farking CURL scripts for the server (why did you even release this plugin?).<\/p>\n<p>Sadly enough, the BEST solution I could find for the problem of integrating Picasa was actually done in straight JavaScript (yay!), found here: <a href=\"http:\/\/www.bloggingtips.com\/2009\/03\/23\/picasa-widgets-and-plugins-for-your-blog\/\">http:\/\/www.bloggingtips.com\/2009\/03\/23\/picasa-widgets-and-plugins-for-your-blog\/<\/a><\/p>\n<p>Her code works great, works fast, requires almost no configuration (besides your Picasa username), and uses <a href=\"http:\/\/jquery.com\">JQuery<\/a>, so pretty much anyone can edit and customize it.<\/p>\n<p>Which I did. ^_^ Though the code works, it doesn&#8217;t appear to always grab your <em>latest<\/em> photos from Picasa. (I&#8217;m guessing it has something to do with the &#8220;max-results&#8221; flag in the URL string &#8212; you <em>have<\/em> to restrict the number of photos that Picasa feeds up for you to get the latest.) I also made each photo be a link to the Picasa page where it&#8217;s at, as well as cleaning up the code a little.<\/p>\n<p>There&#8217;s basically two parts:<\/p>\n<p><strong>First, put this code in a widget text block where you want it to be in your wordpress blog (this is also where you can edit the style):<\/strong><\/p>\n<pre>&lt;style&gt;\n#picasaStream img {border: 1px solid #000; margin: 0 5px 5px 0;}\n&lt;\/style&gt; \n\n&lt;div id=\"picasaStream\"&gt;&lt;\/div&gt;\n<\/pre>\n<p><strong>Second, put this code either right after the widget, or wherever you put your JavaScript (if you choose to put it in another place, like a footer):<\/strong><\/p>\n<pre style=\"overflow: scroll;\">&lt;script type=\"text\/javascript\"\nsrc=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.4.0\/jquery.min.js\"&gt;&lt;\/script&gt;\n\n&lt;script type=\"text\/javascript\"&gt;\n\/*\n****\tUncomment this line if you are using other JavaScript libraries\n****\t(Prototype, Scriptaculous, etc.)\n*\/\n\/\/ jQuery.noConflict();\n\njQuery(document).ready(function(){\n\t\/*\n\t****\tChange your Picasaweb username here,\n\t****\tas well as how many thumbnails you want to show\n\t*\/\n\tvar _userName = \"captainskyhawk\",\n\t\t_count = 6\n\t\t\n\t\/*\n\t****\tChoose your thumbnail size here:\n\t**** \t\"0\" for small, \"1\" for medium, and \"2\" for large\n\t*\/\n\tvar _thumbnailSize = 0;\n\t\n\t\/*\n\t****\tScript Code\n\t****\tNo need to edit any further\n\t*\/\n\tjQuery.getJSON(\"http:\/\/picasaweb.google.com\/data\/feed\/api\/user\/\" \n\t\t+ _userName + \"?kind=photo&thumbsize=72c&access=public&alt=json&max-results=\"\n\t\t+ _count + \"&callback=?\",\n\t\tfunction(data){\n\t\t\tjQuery.each(data.feed.entry, function(index, pic) {\n\t\t\t\tjQuery('&lt;a href=\"' + pic.link[1].href + '\"&gt;&lt;img src=\"'\n\t\t\t\t\t+ pic.media$group.media$thumbnail[_thumbnailSize].url\n\t\t\t\t\t+ '\" alt=\"' + pic.summary.$t + '\" \/&gt;&lt;\/a&gt;')\n\t\t\t\t.appendTo(\"#picasaStream\");\n\t\t\t});\n\t\t}\n\t);\n});\n&lt;\/script&gt;\n<\/pre>\n<p>Just change your name in the code from &#8220;captainskyhawk&#8221; (that&#8217;s me!), and it should work!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>OMG is this so much harder than it needs to be. Picasa (or Google) offers nothing in the way of little blog widgets (unlike Flickr&#8217;s great support for everything), nor is there really any third-party support for this kind of thing out on the web. I don&#8217;t understand why, since &#8212; at least to me [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7,58,18,84],"tags":[90,91,92,88,89,93],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-design","category-internet","category-programming","category-tutorial","tag-google","tag-javascript","tag-jquery","tag-picasa","tag-picasaweb","tag-webdesign"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2ZUZG-9Z","_links":{"self":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":0,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.threshold-zero.com\/cblog\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}