Image file handling with LC on server?
Posted: Sat Aug 29, 2020 6:23 pm
I have LC set up on one of my servers and I've managed to get myself into first gear (as it were) with very basic operations: returning HTML with logic-based content, and driving exiftool using shell(). But I'm still struggling to understand the core concepts and differences between LC running on regular devices (GUI and all) and LC on a server.
I'm honestly not trying to get someone to do this for me, but all pointers, comments and suggestions will be eagerly read and pondered!
Okay... with the sticking points/confusion points in bold, I'd like to be able to:
1: Uploading a JPEG. I can do this easily enough with PHP, but for personal satisfaction I'd appreciate suggestions for how (and if) I should approach this in a more LC-centric way.
2: Getting pixel dimensions. I have this sorted using shell() to call exiftool, which I also use for [4]. As with [1] I'm interested in how I might do this in LC, but it's not a sticking point.
3: Resizing the image. For a regular LC stack I could simply set the filename of an image to the JPEG file, scale it as appropriate, then export a fresh JPEG which can be referenced by HTML. But the LC Dictionary lists the export command as being for desktop and mobile platforms; it doesn't list server. How should I approach using LC on a server to resize an image?
I could use a different server tool, but I want to do as much as I can with LC! It should help me learn this aspect of LC, I think and hope.
4: Adding metadata. Got this working fine using exiftool called from shell().
5: Zip. Not tried it yet but I'm reasonably confident with the zip entries in the Dictionary.
6: Offering the zip for download. This is easy stuff.
I realise allowing file uploads on a public server is a potentially very risky thing to do. I'm very happy to read any thoughts about this too.
Keith
I'm honestly not trying to get someone to do this for me, but all pointers, comments and suggestions will be eagerly read and pondered!
Okay... with the sticking points/confusion points in bold, I'd like to be able to:
- Upload a JPEG
- Get its pixel dimensions
- Resize it to a thumbnail (to be shown in a web page) <- this is where I really hit the headscratching point
- Add some metadata
- Zip the image
- Make it available for download
1: Uploading a JPEG. I can do this easily enough with PHP, but for personal satisfaction I'd appreciate suggestions for how (and if) I should approach this in a more LC-centric way.
2: Getting pixel dimensions. I have this sorted using shell() to call exiftool, which I also use for [4]. As with [1] I'm interested in how I might do this in LC, but it's not a sticking point.
3: Resizing the image. For a regular LC stack I could simply set the filename of an image to the JPEG file, scale it as appropriate, then export a fresh JPEG which can be referenced by HTML. But the LC Dictionary lists the export command as being for desktop and mobile platforms; it doesn't list server. How should I approach using LC on a server to resize an image?
I could use a different server tool, but I want to do as much as I can with LC! It should help me learn this aspect of LC, I think and hope.
4: Adding metadata. Got this working fine using exiftool called from shell().
5: Zip. Not tried it yet but I'm reasonably confident with the zip entries in the Dictionary.
6: Offering the zip for download. This is easy stuff.
I realise allowing file uploads on a public server is a potentially very risky thing to do. I'm very happy to read any thoughts about this too.
Keith