2

I found a script that can upload image to postimage.org using curl. It was posted not long ago, on 2013-09-06, at http://crunchbang.org/forums/viewtopic.php?id=28867. The simplified script looks like this:

curl -Ls -F "upload[]=@$1" -F "adult=no" http://postimage.org/ | grep -Po 'id="code_1".+\Khttp[^<]+'

However, when I tried it, it doesn't work any more. I believe it was working when it was posted not long ago, anyone knows how to get it working again please?

UPDATE:

Having accepted the answer, I found myself just can't do another successful upload any more:

http://s14.postimg.org/rwbs13uil/screenshot.jpg http://s12.postimg.org/8rnq0lzc9/screenshot_png_150314.jpg
http://s3.postimg.org/e7r5yhx4f/aequ6_Nei.jpg
http://s1.postimg.org/e3e6pactn/Ohxoh2ae.jpg
http://s27.postimg.org/eh86w1rvz/aequ6_Nei.jpg

I.e., regardless what I tried, I always end up with the above weird image, which is not mine, with wrong image size and wrong image type/extension.

But in fact, the image I was trying to upload is

http://ibin.co/1uoEZfFcgmxE

So I conclude that there is still something wrong with postimage.org, it's so screwed up that I'll not waste any more of my time on it.

Hm, heck, just want to have a proper conclusion -- I tried to manually upload it via my browser but get exactly the same thing:

http://s27.postimg.org/6qefu76nj/screenshot.jpg

So, conclusion, the curl upload is working as expected, only the postimage.org site is screwed. Case closed.

Thanks

3

The line

curl -Ls -F "upload[]=@Schermata-11.png" -F "adult=no" http://postimage.org/ | \
  grep -Po 'http[^<]*' | \
  grep "\[" | \
  cut -d "]" -f1 | \
  head -1

is working for me :)

  • Can you expand your answer a little to explain what this does? Thanks. – fixer1234 Mar 14 '15 at 0:57
  • Thanks! The posting part is literally the same as mine so I guess it was just a temporarily glitch when I tried it. s29.postimg.org/6y05a8ccl/screenshot.png . Your grepping part doesn't work for me, but that's not the point of OP. As long as the posting part works, I'm happy! +1 – xpt Mar 14 '15 at 15:18
2

The probable reason why it doesn't work anymore is because it's a hack.

Note: this is a hack and will probably break next time postimage change their front page. (Please post if you find a problem.) At that time it will have to be rehacked, or maybe changed to imgur which has a proper api, but needs registration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.