Shashin 1.2 Now Available
Update: There were some bugs in this version, please see my post on version 1.2.3 for the latest update. Also go there for any comments or questions – I’ve turned off further comments on this post.
You can download the latest version of Shashin from wordpress.org. I had to rush this out the door, since Shashin 1.1 doesn’t work with WordPress 2.3.3. That means I didn’t do all the testing I usually do before a release. If you have any problems, please post a comment here (note I turned off comments on Post to Post Links II error: No post found with slug "shashin-wordpress-plugin", as the page was just getting way too long).
The two big new features happen to be the two most requested features: displaying groups of album thumbnails, and the ability to add or sync all your Picasa albums at once. For the album thumbnails, they are displayed in a table with a number of columns you can specify, you can choose to display either only certain albums, or all your albums with your choice of sorting preference, and you can choose whether to display the album titles and locations (if you specified a location in Picasa, Shashin will include a Google Maps link as well). Syncing all your albums at once will make using Shashin easier for those who maintain a lot of Picasa albums.
Another feature I added is smarter album syncing. Now if you move a photo from one album to another in Picasa, Shashin will preserve its original photo key when it syncs the albums. Before I made this change, the old photo key would be deleted and the picture would get a new photo key, thus breaking any Shashin tags that referred to the old key. That problem won’t happen anymore.
The biggest piece of work in this release wasn’t the new features though. It was writing a parser for the Picasa feed from scratch. I got tired of Shashin breaking every time WordPress changed its RSS tools (which seems to happen with almost every new version – that’s what broke Shashin 1.1 when WordPress 2.3.3 was released). Instead of using something big like Magpie, I instead wrote a very lean XML parser – not counting comments, the whole thing is less than 60 lines of code. It uses Snoopy to load the feed, since I can’t rely on PHP functions like fopen being configured across different servers for URL fetching (Snoopy comes with WordPress, so Shashin loads it from there). I would have loved to write the parser in PHP 5, which has a great new set of tools for XML, but a lot of sites out there are still on PHP 4 (including mine), so the parser is PHP 4 friendly.
I’ve noticed my old rss-functions-mod.php file being re-used by folks in other WordPress plugins. That code doesn’t work with the new version of WordPress (I didn’t bother to investigate why, since I was done working on the new parser anyway). If you’re someone who’s used that file in your plugin, you may want to switch to the parser that’s included with Shashin 1.2. But you’ll need to make some adjustments to your plugin, as the data that comes out of the new parser is in a different structure.
Stay tuned for version 1.3, probably in a few weeks. I’m planning to include Highslide integration! 🙂
Comments are Disabled
well,, i think it’s a bug..
Warning: array_rand() [function.array-rand]: Second argument has to be between 1 and the number of elements in the array in /www/users/ryanwong.name/blog/wp-content/plugins/shashin/ShashinPhoto.php on line 286
Error: Not enough photos available to supply 15 random photos
and my album with chinese name display as ???
could u kindly resolve this for me?
Hi Lazing – could you let me know what values you put in the tag you used that generated the error? (or if you used a widget, what you typed in the form). If you requested 15 random photos but there are less than 15 photos in the album, then it is a legitimate error and not a bug.
For the problem with the Chinese characters, could you let me know which tag (or widget) you used? I thought I had fixed all the character encoding issues, but it sounds like I may have missed something.
for array out of bound error
I used a new function added by 1.2
through the pics in each album can changed, i think we need to check the total number of pics before involk the method…
for Chinese Character
after sync albums in this page
all the album with chinese name display as ????
I get the following message when trying to sync an album:
Album metadata synced, but failed to sync photos. This was probably a bad connection trying to read the RSS feed. Please try again.
Is this a temporal problem or has anybody experienced somebody like this before?
hey I got the same error as Lazing
I use the php code
am I inputing them right?
sorry.. the code is below :
php echo Shashin::getRandom(any,144,4,7,n,none,both);
Lazing, Pat – I think I’ve realized what the problem might be. When you say “any” album, Shashin picks one at random. If it happens to pick an album with fewer photos than the number of photos you requested, then you will get an error. That’s a flaw in the logic, and I’ll work on fixing it. Until I have a fix ready, I’d recommend either 1. pick an album for now, instead of “any” or 2. don’t ask for more pictures than the number of pictures in your album that has the fewest.
Hi Stefan – that error should be transient. I’ve had a couple other reports of that error in the past, and then it goes away a little while later. I’d say try again in a a few hours and see if it clears up. Picasa has a feed that describes your albums (title, pub date, etc), and then it has a separate feed for the photos in each album. The error means Shashin was able to read the former feed but not the latter. If the error doesn’t go away for you within 24 hours, let me know.
i got the same as Stefan. but i do not think it is transient. because it is work nice on my local machine at same time but one the server there is a Warning: Invalid argument supplied for foreach() on the top of the Shashin-admin page before add my album.
i think the PHP version difference is the reason.
Hi Santiao – thanks for letting me know. Could you send me the exact error message, and let me know which version of PHP you’re running?
Yes, the message i just mention is:
Warning: Invalid argument supplied for foreach() in /wwwroot/wp-content/plugins/shashin/Shashin.php on line 418
my server side is PHP4.3.7, and my MAMP is PHP 5.2.0