New app: Scanner - get image files direct from your scanner

Hi there!

I’ve been playing with NC for about a month - loving it so far! Great work guys!

One of the interesting options for me was to use NC for my document-management solution. However, I couldn’t find any apps which enable me to scan files directly into NC. I could, of course, scan them locally and then upload, but this is a clunky solution :slight_smile:

So, I decided to get my hands dirty, and write an app for this function. I’m happy to introduce you to Scanner v0.0.2. Source is at https://gitlab.com/gwmngilfen/nextcloud-scanner/tree/master

The functionality is pretty simple - it adds a new entry to the New File Menu, which when clicked acquires a scan (via SANE’s cmdline scanimage) and puts the image content in the file. See the README screenshots for more details.

However, I’m totally new to PHP, and pretty terrible at Javascript, so this app has been duct-taped together using the app tutorial and ideas/code from other peoples apps. As such, it’s working for me, but:

(a) there’s definitely stuff that’s broken (see Known Issues in the repo)
(b) there’s probably stuff that’s wrong / insecure
© there’s no tests (yet!)

(By the way, it’s a massive credit to your app docs that I got this far. Figuring out the way to wire up the file storage stuff was fun :stuck_out_tongue: )

I’d really like to make this a decent quality app, but as stated, I know zero PHP - so all suggestions for how to improve the code are welcome. Right now I’d love to have a spinner while the scan is in progress, and to have the file view properly refresh when the scan is complete. I’ll also be looking at adding tests in the short term. After that, I’ll release it to the app store, if it’s useful to others.

Thanks for reading, and thanks in advance for any help!
Greg

3 Likes

great ! Sounds Interesting :slight_smile:

Why not just use the desktop client and set it to automatically sync a local folder that you scan to? That way you don’t need to write an app or manually upload anything. Just scan to the local folder and access the scans in Nextcloud almost immediately…

@Bugsbane good question - that’s clearly an option. Other than the obvious answer of “choice is good!”, there’s a couple more use cases that are relevant to me:

  1. My scanner isn’t attached to my laptop. It serves the whole house via a RaspberryPi on the house network. I could (of course) install sane-utils on every laptop and desktop and scan into my sync client folder, but still…
  2. My wife doesn’t often use her laptop - being able to initiate a scan from her tablet browser is a win. She could take a photo and use the Android sync app, but the scanner will generally do a better job on documents.
  3. In either of these cases, the files don’t always end up exactly where you want them in Nextcloud - e.g. I only sync a subdirectory to my laptop. That means anything I add via the sync client would later need moving to the Scans folder in the Nextcloud UI, which isn’t particularly efficient. Being able to go to the Scans folder first and then say “Scan an image in here” makes that feel much smoother.

And of course, the final argument is - because I wanted to try writing an app :slight_smile:. Ultimately, if the sync client works for you, then sure, this app has no value. But it adds flexibility to how I use NC, and I hope it’s valuable to others.

Thanks for making me think out the usecases though - I think I’ll add that to the README :slight_smile:

Thanks! I was just curious as I was having difficulty thinking of a usecase. I definitely want saying you shouldn’t write the app! Glad it’s helping you and hopefully other people in a similar situation. :slight_smile:

Dynamic Web TWAIN is good but not free

Nice! Found this after my own approach :wink: