3

This is what I have now, it works on a single image.

curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@/path/to/image https://api.imgur.com/3/upload.xml

to get the result open in your browser, I have

curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@/path/to/image https://api.imgur.com/3/upload.xml | grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<.*>//' | sed  's/^.*imgur\.com\//http:\/\/imgur.com\//g;s/\.[^.]*$//' | xargs xdg-open 

but how can I upload multiple images to an anonymous album ?

I knew I can create an album with

curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F "title=imgur"  https://api.imgur.com/3/album

Then I guess I need to make some curl calls on each and every one of my images to add them to the album one by one? Or There is some magic command that I can do all of these in just one curl call? (create the album, upload multiple images, and get the album link back)

Imgur image upload api says there is a album key, but I don't know how to pass it with curl.(I can see the deletehash from the result of last album creation call.)

The ultimate goal is to add some menu to kde dolphin browser( as servicemenu ) Single image upload is already working.

screenshot

3
  • I hope you've not put the personal credentials in question. ;) Commented Jul 10, 2016 at 6:51
  • 1
    I thought it was a publicly shared client id? Commented Jul 10, 2016 at 7:01
  • I see ! You're good then. Commented Jul 10, 2016 at 7:02

1 Answer 1

1

find command is your friend.

Suppose you wish to upload all the .png images you could do the below stuff.

find /path/to/images/folder -maxdepth 1 -type f  -name "*.png"  \
     -print0 | while read -rd '' filename
do
curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" \
     -F image=@"$filename" https://api.imgur.com/3/upload.xml
done
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! but how could I create an album and add all the images to that album?
Sorry pal ! There should be workaround for that too.,but I think I should stop at this point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.