library: scan with a phone camera (Quick Add)
A 'Scan with camera' button opens the phone's own camera app; the photo is shrunk on the phone and read on the server with zbarimg, then goes through the normal add flow (also available on the sticker step). Works over plain HTTP on iPhone and Android - no HTTPS needed. - /api/scan: JPEG/PNG only (checked by magic bytes before ImageMagick sees it), 12 MB cap, login required, 20 s timeout, temp files cleaned up - UPC-A reads (zbar reports 13 digits with a leading zero) normalised to the 12 digits printed on the item so duplicate checks match - tests/gen_photos.py + tests/check_scan.py: phone-like photos (tilt, blur, noise, low light, upside down, EXIF rotation, small, UPC, Code 39 sticker); 10/10 read at the size the page sends Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
+13
-2
@@ -51,8 +51,19 @@ for many of them.
|
||||
The page beeps: high for added, double for a duplicate, low for not found. You can scan a
|
||||
stack of books without looking at the screen.
|
||||
|
||||
Phone camera scanning is not built in (browsers only allow the camera on HTTPS or
|
||||
`localhost`). A scanner-app that "types" the code into the box works.
|
||||
### Scanning with a phone camera
|
||||
|
||||
Open the Add books page in your phone's browser and tap **Scan with camera**. Your phone's own camera app
|
||||
opens; take a photo with the barcode filling the frame, and the book is looked up and added just as if you had
|
||||
typed it. In "scan a pre-printed sticker" mode the same button appears on the sticker step.
|
||||
|
||||
* It works over plain HTTP on both iPhone and Android: the photo is taken by the phone's camera app, shrunk on
|
||||
the phone, and read on the server (`zbarimg`). Only JPEG and PNG photos are accepted.
|
||||
* It reads ISBN-13 and ISBN-10 barcodes, and UPC/EAN codes on discs and games.
|
||||
* Tips: get close so the barcode fills most of the frame, keep it flat and well lit, and hold steady. If it
|
||||
can't read the photo you are told, and nothing is added.
|
||||
* A live viewfinder that reads continuously would need HTTPS (browsers only allow that for secure pages); a
|
||||
Bluetooth scanner paired to the phone also works, since it types into the page.
|
||||
|
||||
## Barcodes: your choice
|
||||
|
||||
|
||||
Reference in New Issue
Block a user