Before you ask please READ THIS

Importing Picasa/google album to Album post-my 2 cents feature

edited January 2013 in Spaceship Posts: 4
Hi there
i am using Shashin plugin (http://www.toppa.com/shashin-wordpress-plugin/)
i wrote little function than can be applied to import full google(picasa) album to An Album CPT
here it is.

function createAlbumFromShashinAlbum($shashinAlbumID,$albumPostID){

global $wpdb;
$sqlcquery2run = "SELECT * FROM `wp_shashin_photo` WHERE `albumId` = '".$shashinAlbumID." ' ORDER BY `id`";
$sqlcountresult = $wpdb->get_results($sqlcquery2run);


$counterInt = intval(get_post_meta($albumPostID, "_image_count",true));

$counterInt = $counterInt +1;
foreach ($sqlcountresult as $sqlcountcurrent) {

$counter = (string)$counterInt;
//echo $sqlcountcurrent->contentUrl.",".$counter;

add_post_meta($albumPostID, '_image_or_video_'.$counter, "post_image_".$counter);

add_post_meta($albumPostID, '_post_image_id_'.$counter ,"");

add_post_meta($albumPostID, '_post_image_'.$counter,$sqlcountcurrent->contentUrl );

add_post_meta($albumPostID, '_post_image_name_'.$counter ,"");
add_post_meta($albumPostID, '_post_image_desc_'.$counter,"" );
add_post_meta($albumPostID, '_bg_color_'.$counter,"" );
add_post_meta($albumPostID, '_font_color_'.$counter,"" );
add_post_meta($albumPostID, '_text_bg_color_'.$counter,"");
add_post_meta($albumPostID, '_post_video_'.$counter,"");
add_post_meta($albumPostID, '_video_thumb_'.$counter,"" );
add_post_meta($albumPostID, '_video_autoplay_'.$counter ,"1");
add_post_meta($albumPostID, '_image_position_'.$counter, $counter);

$counterInt = $counterInt+1;
}
update_post_meta($albumPostID, "_image_count", (String)$counterInt);

}
All you need to know is the album id from shashin tables (wp_shashin_album)
hope someone will find this helpfull.
Post edited by Air on

Comments

  • AirAir
    Posts: 10,970
    Hello.

    Thanks a lot for that. If anyone will ask about it I will send him/her here. I edited your post just to put code in <pre> ;-)

    With regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion