Page 1 of 1

Image file handling with LC on server?

Posted: Sat Aug 29, 2020 6:23 pm
by thatkeith
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. Upload a JPEG
  2. Get its pixel dimensions
  3. Resize it to a thumbnail (to be shown in a web page) <- this is where I really hit the headscratching point
  4. Add some metadata
  5. Zip the image
  6. Make it available for download
Some details about these points...

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

Re: Image file handling with LC on server?

Posted: Sat Aug 29, 2020 6:51 pm
by FourthWorld
thatkeith wrote:
Sat Aug 29, 2020 6:23 pm
...the LC Dictionary lists the export command as being for desktop and mobile platforms; it doesn't list server.
"Platforms" shows "desktop,web":
https://livecode.com/resources/api/#liv ... th_palette

That doesn't seem right either, since "web" should probably be "server", and "mobile" is missing there.

The functionality you're looking for is definitely available. See this Lesson:

"How do I use LiveCode graphics features server-side?"
http://lessons.livecode.com/m/15262/l/1 ... erver-side

Re: Image file handling with LC on server?

Posted: Sat Aug 29, 2020 10:51 pm
by thatkeith
Hi Richard,

Thanks! I've just read through some of this and it is *definitely* going to help!

Wow. [grins widely]

k

Re: Image file handling with LC on server?

Posted: Sun Aug 30, 2020 10:46 am
by bangkok

Re: Image file handling with LC on server?

Posted: Sun Aug 30, 2020 10:38 pm
by thatkeith
[bows in thanks] :D