HaschekSolutions / pictshare

:camera: PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. :rice_scene:
https://www.pictshare.net
Apache License 2.0
840 stars 125 forks source link

Uploading images directly using curl #114

Closed hisacro closed 4 years ago

hisacro commented 4 years ago

I cannot seem to find any resource to do this on pictshare.net.. uploading directly from command line and get the link curl -F 'image=??' pictshare.net < image_file

I find it really useful as I always rely on these curl -F 'sprunge=<-' sprunge.us curl -F 'f:1=<-' ix.io

pointing to any resource on how to do that will be much appreciated.

geek-at commented 4 years ago

you can find the curl upload command here

hisacro commented 4 years ago

adding this just in case if any one don't want to use jq..
define this function in .bashrc

pictshare(){
curl -s -F "file=@-" https://pictshare.net/api/upload.php  |  sed -e 's/,/\n/g; s/\\//g; s/\"/ /g' | grep url | column -t
}

usage


pictshare < file.png        # uploading files
import png:- | pictshare    # uploading screenshots using imagemagick's import 

output will be

url         :  https://pictshare.net/xxx
delete_url  :  https://pictshare.net/delete_xxxx 

if the terminal emulator is set to recognize links then clicking can open it in browser.