Sorry, but I cannot figure out how this works.
I loaded the plug-in and it shows in the plug-in manager, but I can't see how it is supposed to wrk.
Thanks in advance,
Eric
Board index ‹ PBase ‹ Feature Requests ‹ Adobe Lightroom PBase Export Plugin - PBasic v1.0
ericm1461 wrote:Sorry, but I cannot figure out how this works.
I loaded the plug-in and it shows in the plug-in manager, but I can't see how it is supposed to wrk.
Thanks in advance,
Eric
callieian wrote:I installed this in Lightroom on my XP laptop while travelling and it worked great! Everything was perfect ... Now I'm home and transferred everything to my PC and the plugin won't connect to my pbase account. The only thing I can think of is that I am using 64-bit Vista installation of Lightroom. Would this make a difference to how the plugin connects?
fimkap wrote:It works in LR 3 Beta on XP 32-bit. I have just used withReadAccessDo in PBasicUploadTask.lua and reenabled the plugin from plugin manager. Thank you very much for this plugin. I will give it a try on my home LR 2.4 on Win7 64-bit.
--[[
PBasicUploadTask.lua
Uploads the rendered photos
--------------------------------------------------------------------------------
Copyright Ross Marchant 2008
Based on the Adobe Flickr plugin example
--------------------------------------------------------------------------------
]]
--Lightroom API
local LrDialogs = import 'LrDialogs'
local LrErrors = import 'LrErrors'
local LrFileUtils = import 'LrFileUtils'
local LrHttp = import 'LrHttp'
local LrPathUtils = import 'LrPathUtils'
local LrTasks = import 'LrTasks'
local prefs = import 'LrPrefs'.prefsForPlugin()
local logger = import 'LrLogger'( 'PBaseAPI' )
local debug, info, warn, err = logger:quick( 'debug', 'info', 'warn', 'err' )
--Constructor
PBasicUploadTask = {}
--[[
Process to upload the photos (is run as a task)
]]
function PBasicUploadTask.processRenderedPhotos( functionContext, exportContext )
local exportSession = exportContext.exportSession
local exportParams = exportContext.propertyTable
--Check if gallery needs to be created
if PBasicAPI.galleryList[exportParams.galleryName] and exportParams.createNew == "existing"
then
--Gallery exists... just upload there
else
--Check gallery isn't already created
if PBasicAPI.galleryList[exportParams.galleryNameNew]
then
LrDialogs.message("A gallery with that name already exists!")
return
else
--Gallery doesn't exist, create new
--Strip punctuation
exportParams.galleryName = string.gsub(exportParams.galleryName, "(%p)", "")
exportParams.galleryName = string.gsub(exportParams.galleryName, "(%s)", "_")
exportParams.galleryName = string.lower(exportParams.galleryName)
--Show progress
local progressScope = exportContext:configureProgress{
title = LOC( "$$$/PBasic/Upload/Progress=Creating gallery ^1 on PBase", exportParams.galleryName )
}
--Create new gallery
local response = LrHttp.post("http://upload.pbase.com/edit_gallery/"..prefs.username.."/"..exportParams.galleryName,
"parent_gid="..PBasicAPI.galleryList[exportParams.galleryName].."&gallery_name="..exportParams.galleryNameNew.."&submit=New+Gallery",
{{field = "Content-Type", value = "application/x-www-form-urlencoded"}})
--Set to place uploaded images at end
local response = LrHttp.post("http://upload.pbase.com/edit_gallery/"..prefs.username.."/"..exportParams.galleryNameNew.."&view=sequence",
"gallery_placement=L&image_placement=L&submit=Update+Placement+Settings",
{{field = "Content-Type", value = "application/x-www-form-urlencoded"}})
progressScope:done()
end
--Save gallery name
exportParams.galleryName = exportParams.galleryNameNew
prefs.galleryName = exportParams.galleryNameNew
prefs.galleryNameNew = ''
--Set option to existing
prefs.createNew = "existing"
end
--Set progress title.
local nPhotos = exportSession:countRenditions()
local progressScope = exportContext:configureProgress {
title = nPhotos > 1
and LOC( "$$$/PBasic/Upload/Progress=Uploading ^1 photos to PBase", nPhotos )
or LOC "$$$/PBasic/Upload/Progress/One=Uploading one photo to PBase",
}
--Save off uploaded photo IDs so we can take user to those photos later.
--local uploadedPhotoIds = {}
local nuploadedPhotos = 0;
--Iterate through photo renditions.
for i, rendition in exportContext:renditions{ stopIfCanceled = true } do
--Get next photo.
local photo = rendition.photo
local success, pathOrMessage = rendition:waitForRender()
--Check for cancellation again after photo has been rendered.
if progressScope:isCanceled() then break end
if success then
--Build up common metadata for this photo.
local title, description
photo.catalog:withReadAccessDo( function()
--Title
title = photo:getFormattedMetadata 'title'
if not title or #title == 0 then
title = LrPathUtils.leafName( pathOrMessage )
end
--Description
description = photo:getFormattedMetadata 'caption'
--Post data to PBase
local postUrl = "http://upload.pbase.com/edit_gallery/"..exportParams.username.."/"..exportParams.galleryName
local mimeChunks = {}
--File
mimeChunks[ #mimeChunks + 1 ] = {
name = 'fname',
fileName = PBasicAPI.htmlEscapeString(title),
filePath = rendition.destinationPath,
contentType = 'image/pjpeg' }
--Button
mimeChunks[ #mimeChunks + 1 ] = { name = "submit", value = "Upload Image" }
local result = ""
--Post it and wait for confirmation.
if LrTasks.pcall( function ()
result = LrHttp.postMultipart( postUrl, mimeChunks )
end )
then
if exportParams.saveMetadata == "yes"
then
--Set the gallery stuff
local imageId = string.match(result, [[update_image/(%d+)">]])
--local caption = photo:getFormattedMetadata 'caption'
local pString = { submit = "Update Image",
title = title,
caption = description,
artist = photo:getFormattedMetadata('creator'),
location = photo:getFormattedMetadata('location'),
shot_date = photo:getFormattedMetadata('dateTime'),
camera_body = photo:getFormattedMetadata('cameraModel'),
description = string.gsub(photo:getFormattedMetadata('exposure'), string.char(198,146), "f").." at "..photo:getFormattedMetadata('focalLength'),
keywords = photo:getFormattedMetadata('keywordTags'),
public_flag = "Y",
}
--LrDialogs.message("post: "..PBasicAPI.postString(pString))
--Update image data
result = LrHttp.post("http://www.pbase.com/update_image/"..imageId,
PBasicAPI.postString(pString),
{{field = "Content-Type", value = "application/x-www-form-urlencoded"}})
end
nuploadedPhotos = nuploadedPhotos + 1
--LrDialogs.message("Failure!!!")
end
end )
end
end
--Open gallery in browser for checking
--LrDialogs.message( LOC ("$$$/PBasic/Upload/ProgressComplete=^1 of ^2 photos uploaded successfully", nuploadedPhotos, nPhotos) )
if exportParams.openGallery == "yes"
then
LrHttp.openUrlInBrowser ("http://www.pbase.com/"..exportParams.username.."/"..exportParams.galleryName.."&page=all")
end
end
Board index ‹ PBase ‹ Feature Requests ‹ Adobe Lightroom PBase Export Plugin - PBasic v1.0
Users browsing this forum: No registered users and 0 guests