How do you upload images to a forum discussion?
-
I do not see an option any where.
-
There isn't one. I like to use pyimgur with this script to get something I can paste into the forum:
import pyimgur,photos,clipboard,os,console i=photos.pick_image() format = 'gif' if (i.format == 'GIF') else 'jpg' i.save('img.'+format) clipboard.set('.upload_image('img.'+format, title="Uploaded-Image").link)+')') console.hud_alert("link copied!") os.remove('img.'+format)
-
That is extremely useful and clever. Thank you.
-
Tried to run in Pythonista 1.5 and the script cannot find module: pyimgur
-
Yes, you have to install pyimgur. Try the following code to install the module, then run the first script and it should work.
import shutil, urllib2, os, zipfile f=urllib2.urlopen('https://codeload.github.com/Damgaard/PyImgur/zip/master') with open(os.path.expanduser('~/Documents/pyimgur.zip'),'w') as z: z.write(f.read()) z=zipfile.ZipFile(os.path.expanduser('~/Documents/pyimgur.zip')) z.extractall() os.remove(os.path.expanduser('~/Documents/pyimgur.zip')) shutil.copytree(os.path.expanduser('~/Documents/PyImgur-master/pyimgur'), os.path.expanduser('~/Documents/site-packages/pyimgur')) shutil.rmtree(os.path.expanduser('~/Documents/PyImgur-master'))
-
@donnieh, I am not sure if you meant just with code, but if you have Dropbox, you can add an image from Dropbox using this notation

https://www.dropbox.com/s/wnfl6zar18kwbvk/File 6-12-2015%2C 15 51 04.jpeg?dl=0
Change dl=0 to raw=1
Can't compose the whole thing here, as it will render the image.
But the first line is the format. The 2nd line is the link to the image from Dropbox. You just copy that into the () and change the last param from dl=0 to raw=1
-
@Phuket2 your solution is indeed what I was looking for; however, @Webmaster4o had an interesting approach.
-
@donnieh , lol...yes interesting. I am still scratching my head. But he is a young guy and will see the world in different ways which is great. I like looking at his code. In a very short time he has gone so far, more than me. But great to see.but sometimes we just need the simple answers also 😎🎉
-
@Phuket2 Those are not normally how I write code. Those two examples were designed to be concise rather than readable. I especially had fun making the second script for installing pyimgur, although it was a pretty brief script.
-
Yeah... The single letter variable names cause me to cringe. We used to have to write code with such short variable names. These daze variable names should help the reader of the code understand what is intended / going on.
-
@Webmaster4o , it wasn't about your code. It was that it was a code answer. Anyway, nothing meant by it it. I couldn't have even given a code answer 😁
-
I absolutely welcome any opinion. Some of the best ideas can come from the most subtle places. As a hardware engineer trying to program, I enjoy such input from programmers' points of view. One thing I learned about programmers is they usually think they are smarter than than the average joe, and they usually are!
-
@donnieh , I agree. I was having a chuckle because was very left field for me. But still thought it was good