Skip to content

Instantly share code, notes, and snippets.

View carzacc's full-sized avatar

Carmine Zaccagnino carzacc

View GitHub Profile
@carzacc
carzacc / onpressedmain.dart
Last active February 9, 2019 21:28
image_picker guide
onPressed: () async {
var imgFile = await ImagePicker.pickImage(
source: ImageSource.camera
);
setState((){
imgs.add(Image.file(imgFile));
});
}
from wand.image import Image
from wand.drawing import Drawing
import os
from sys import argv
from shutil import copyfile
class ImageProcessor:
"""
The interface between our tool and
the Wand library
@carzacc
carzacc / actions.py
Last active November 18, 2019 15:32
from imageprocessor import ImageProcessor
def process_dir(args):
"""
Process the images: copy them so that
you can recognize what directory
they came from both from their name
and from the text annotated over them.
"""
import argparse
import actions
parser = argparse.ArgumentParser(
description="Improve the way you look at your picture collection with this simple CLI tool"
)
subparsers = parser.add_subparsers()
generate = subparser.add_parser("generate", help="Generate the pictures")
(String filename, String url) async {
var request = http.MultipartRequest('POST', Uri.parse(url));
request.files.add(
http.MultipartFile(
'picture',
File(filename).readAsBytes().asStream(),
File(filename).lengthSync(),
filename: filename.split("/").last
)
);
(String filename, String url) async {
var request = http.MultipartRequest('POST', Uri.parse(url));
request.files.add(
http.MultipartFile.fromBytes(
'picture',
File(filename).readAsBytesSync(),
filename: filename.split("/").last
)
);
var res = await request.send();
(String filename, String url) async {
var request = http.MultipartRequest('POST', Uri.parse(url));
request.files.add(
await http.MultipartFile.fromPath(
'picture',
filename
)
);
var res = await request.send();
}
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:http/http.dart' as http;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
class UploadPage extends StatefulWidget {
UploadPage({Key key, this.url}) : super(key: key);
final String url;
@override
_UploadPageState createState() => _UploadPageState();
}
class _UploadPageState extends State<UploadPage> {
var express = require('express')
var multer = require('multer')
var fs = require('fs');
var upload = multer({ dest: 'uploads/' })
var app = express()
app.post('/upload', upload.single("picture"), function (req,res) {
console.log("Received file" + req.file.originalname);
var src = fs.createReadStream(req.file.path);