Copy link to clipboard
Copied
Hi all,
I'm not a professional developer, but I have some knowledges (even if I never developped in lua ) .
I'm trying to adapt the ftpupload sample to make the export and ftp upload on a server much easier (1 click)
So, I started to adapt the ftpupload sample with some success
When I select a photo, it's uploaded in the right way : Nice !
But, as written above, I'm trying to do this in 1 click.
So, I hide everything I do not want to change (it works !) Just kept the watermark option and the ftp parameters.
But now the 2 last steps I would like to automate are:
1. Automatically apply the parameters (format, colorspace,JPG quality, Height, Width ...) during export
2. Rename the export file before ftp transfer
- Replace spaces by _
- Replace every accent by the standard letter (example é=>e à =>a ...)
- Complete filename in lowercase,
And for these 2 steps (in fact just the 1st at the moment), I spend the last 3 days here and on other forums without finding a way how to bring it to work
I tried many many different things, none of them worked (I probably alsway did something wrong, but what...) .
Current situation :
As far as I understood right the different topoics I have read, I should add the export settting before the transfert (it make sense )
So, I added in the FtpUploadServiceProvider.lua this
updateExportSettings = function( settings )
settings.LR_format = "JPEG",
settings.LR_export_colorSpace = "sRGB",
settings.LR_jpeg_quality = 0.5,
settings.LR_size_doConstrain = true,
settings.LR_size_doNotEnlarge = true,
settings.LR_size_maxHeight = 100,
settings.LR_size_maxWidth = 100,
settings.LR_size_resizeType = "wh",
settings.LR_size_resolution = 5,
settings.LR_size_resolutionUnits = "inch",
settings.LR_size_units = "pixels",
end
I put this in the "return" just before the call to
processRenderedPhotos = FtpUploadTask.processRenderedPhotos,
But, it do not work either, no resize, no other parameter applied
So, finally, I decided to ask for some help
Thanks in advance
Copy link to clipboard
Copied
No answers
Really no one here could explain how to set export values and rename a file during export ?
Copy link to clipboard
Copied
Really no one here could explain how to set export values and rename a file during export ?
There's not many of us who participate here anymore. I don't have much experience with general export.
Copy link to clipboard
Copied
OK, Thanks for the info
Just to give a feedback about my searches :
For the second point (remanming the export file), I found a way (maybe not the best one, but as witten above, I'm not a programmer ) to solve it
So, I share the way I did.
In the FTPUploadTask.lua file I add a Rename function to replace all the letters/signs I do not want in the filename
function RenameFilename( Myfilename )
local Newfilename = Myfilename
Newfilename = Newfilename:gsub("%a",string.lower)
Newfilename = Newfilename:gsub("^%s*(.-)%s*$", "%1")
Newfilename = string.gsub(Newfilename, " ", "_")
Newfilename = string.gsub(Newfilename, "__", "_")
-- these caracters due to localisation issues with accents
Newfilename = string.gsub(Newfilename, "(é)", "e")
Newfilename = string.gsub(Newfilename, "(ê)", "e")
Newfilename = string.gsub(Newfilename, "(è)", "e")
Newfilename = string.gsub(Newfilename, "(ë)", "e")
Newfilename = string.gsub(Newfilename, "(Ã )", "a")
Newfilename = string.gsub(Newfilename, "(â)", "a")
Newfilename = string.gsub(Newfilename, "(ä)", "a")
Newfilename = string.gsub(Newfilename, "(û)", "u")
Newfilename = string.gsub(Newfilename, "(ù)", "u")
Newfilename = string.gsub(Newfilename, "(ç)", "c")
Newfilename = string.gsub(Newfilename, "'", ".")
Newfilename = string.gsub(Newfilename, "%%", "_")
Newfilename = string.gsub(Newfilename, "%&", "_")
Newfilename = string.gsub(Newfilename, "%(", "_")
Newfilename = string.gsub(Newfilename, "%)", "_")
Newfilename = string.gsub(Newfilename, "__", "_")
Newfilename = string.gsub(Newfilename, "%.%.", ".")
Newfilename = string.gsub(Newfilename, "_%.", ".")
Newfilename = Newfilename:gsub("^_*(.-)_*$", "%1")
return Newfilename
end
After the line where the filename is affected, I add the call to the renaming function
local filename = LrPathUtils.leafName( pathOrMessage )
filename = RenameFilename(filename)
So, let's continue to find where I have to put these lines to bring my export files parameters to work. I now I just need to call this "param" function, But still now, I couln't find where
local params = {}
params.LR_jpeg_quality = 0.5
params.LR_jpeg_useLimitSize = false
params.LR_metadata_keywordOptions = "lightroomHierarchical"
params.LR_minimizeEmbeddedMetadata = false
params.LR_outputSharpeningLevel = 2
params.LR_outputSharpeningMedia = "screen"
params.LR_outputSharpeningOn = false
params.LR_reimportExportedPhoto = false
params.LR_reimport_stackWithOriginal = false
params.LR_reimport_stackWithOriginal_position = "below"
params.LR_size_doConstrain = true
params.LR_size_resolution = 5
params.LR_size_resolutionUnits = "inch"
params.LR_size_maxHeight = 200
params.LR_size_maxWidth = 200
params.LR_size_resizeType = "wh"
params.LR_format = "JPEG"
params.LR_export_colorSpace = "sRGB"
Copy link to clipboard
Copied
So, Finally it works !
Instead of tying to adapt the ftpupload sample, I started from scratch (but with more knowledge based on the hours and hours spend with this issue) and finally it's ok. I can export and transfer my photo.
Now, I wanted to extend the functionnalities, but I have another issue with the dialog, but I will create a new topic about the new problem.