today I’ve a problem that I can’t seem to find a solution to.
I have a very basic Kirby webapp that displays images that have been uploaded by a smartphone to a folder by SFTP. The workflow is like this:
-Snap a picture
-open FTP app (Transmit on iOS)
-connect to server
-upload picture
nice and easy. my webapp creates thumbs from the images via imageMagic. I enabled autoOrient in the thumbs.php in the toolkit. It now turns the tumbnails correctly but the aspect ratio is totally off - the pictures look squashed.
Now I wonder is there a way to “preprocess” the pictures directly after upload so the thumbnails are generated out of an image that has bee already oriented correctly?
Hope I get the message across…
I use swipebox to display the original sized picture. the picture is in the wrong orientation on swipebox too. that’s why I’d like to orient the pictures upon upload so everything is right in the first place. Or would that be the wrong approach?
oh and I use masonry in order to display the thumbnails…
Yeah I’ve seen that already but I don’t really get it. I think the image converter only works for images that have been uploaded via panel which I don’t do.
for the thumbs: can I call auto orient in my code or do I have to change it in thumbs php?
Since this is an option, you can call it in your code, just as you do with the other options.
Edit: If I get it right, you could try to use the ImageConverter plugin instead of the thumbs class. You don’t need to upload the images via the panel. But not tested, so I might be wrong.
If you want to use a panel hook, you would have to upload images via the panel, but that is not required for the plugin to work.
thumbs: I now call the autoorient option in my thumb array and yay it works! Images are still squashed though
putting auto orient first and then resize (in my code) doesn’t change a thing. can I switch the order any other way?
picture preprocessing: I’ve no clue how to get the plugin to work how does it recognize if new pictures have been uploaded? and how is it triggerd if pictures will not run through the panel?
nope. I tested it by disabling all frontend js stuff. The aspect ratio of the thumb image file itself is off. It’s the same issue @R4ttlesnake mentions in the thread @texnixe posted.
maybe I’m stupid but where do I put it? the images do not get processed in any way if i upload them to a directory via FTP, right? So where will the plugin get called?
okay sorry for being stupid but i can’t seem to get the plugin with its params into my code so it does things right.
If I put it as a replacement for my thumb generating code as @texnixe proposed it just keeps duplicating the images inside the folder . Otherwise I get server error 500 when I play around too much hehe
I mean, yeah, that’s what it does: “This creates a new image in the same destination, as the original image and adds the suffix ‘_resized’ to the filename.”
You can use either of the two approaches. Using both is not very useful.
basically I put auto-orient at the very pottom so it’s the last operation the script does. This way it does not interfere with image resizing that now is performed first!