Erikhht / gaewiki

Automatically exported from code.google.com/p/gaewiki
0 stars 0 forks source link

Support for image uploads #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure about other files, but the ability to upload pictures would be great.  
With resizing and comments, like in wikipedia.

Original issue reported on code.google.com by justin.forest on 2 Nov 2010 at 10:33

GoogleCodeExporter commented 9 years ago
Issue 53 has been merged into this issue.

Original comment by justin.forest on 25 Nov 2011 at 10:57

GoogleCodeExporter commented 9 years ago
Will this be support soon?

Original comment by wuchao.h...@gmail.com on 6 Dec 2011 at 3:59

GoogleCodeExporter commented 9 years ago
Give me a week, I'll see what I can do.

Original comment by justin.forest on 6 Dec 2011 at 12:02

GoogleCodeExporter commented 9 years ago
I think I've got a working implementation of this, using the blobstore to hold 
and serve the images, but it's somewhat tied to the markdown editor image 
insertion from the pagedown project.  I've attached a diff of my current 
gaewiki against revision 1561fd24d396.

Original comment by Is...@wowzers.com on 9 Feb 2012 at 7:14

Attachments:

GoogleCodeExporter commented 9 years ago
Here's a *far* more concise bit of code to implement the very basics of image 
uploading to the blobstore via POST.  In order to use it, a GET request to 
/w/image/ returns a URL (as plain text) generated by the blobstore to be used 
as the target of a POST request.  The POST request should then have the single 
image file sent as "file" (e.g., one might use '<input type="file" 
name="file">'), encoded as 'multipart/form-data'.  The POST will return the URL 
(as plain text) at which the AppEngine Image API is serving the image.

It seems that the Image API defaults to shrinking large images down to a more 
medium size, which is actually probably better for a wiki.  The Image API URLs 
can be modified to resize or crop the image (e.g., appending =sNNN to the end 
of the URL will resize the image so that its larger dimension is NNN (though it 
won't enlarge past the dimensions of the original image); see 
http://code.google.com/appengine/docs/python/images/functions.html#Image_get_ser
ving_url for details.

Having the Image API serve up the images is also beneficial because it incurs 
no processing cost to us, sets some reasonable caching parameters, and ought to 
be pretty fast.

Original comment by Is...@wowzers.com on 13 Feb 2012 at 7:11

GoogleCodeExporter commented 9 years ago
Oops, missed a function in my code attachment.  Here's the amended version.

Original comment by Is...@wowzers.com on 13 Feb 2012 at 7:15

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision f853d18e07a4.

Original comment by justin.forest on 19 Feb 2012 at 10:34

GoogleCodeExporter commented 9 years ago
Isaac, thank you for the code.

Please see if this works well and feel free to reopen if it doesn't.

Original comment by justin.forest on 19 Feb 2012 at 10:35

GoogleCodeExporter commented 9 years ago
It looks good (and much more elegant and wiki-like than mine), but it's a 
non-trivial merge against the way that I've got image-uploading working right 
now, so it'll be at least a couple of days before I get to trying it.

Original comment by Is...@wowzers.com on 21 Feb 2012 at 12:47

GoogleCodeExporter commented 9 years ago
The only issue I see is that the image size (width="nnn" height="nnn") isn't 
included in the <img/> tag. It's knowable using the appengine Image class's 
width() and height() functions at least for the unscaled versions.

Also, it would be nice to replace the sidebar header's image with one uploaded 
with this method. It's possible as it is, but clicking on the image won't lead 
you to the main page. It will lead you to the image viewer for that image.

Original comment by kenny@the-b.org on 21 Feb 2012 at 5:32

GoogleCodeExporter commented 9 years ago
Here are patches for stripping the "http:" from the image URLs (so that if the 
page request is HTTPS, the images will be, too) and for adding the ability to 
set the image title text in the wiki link syntax.  (I've just put these into 
place in my own install, so they haven't really been thoroughly tested.)

Original comment by Is...@wowzers.com on 25 Feb 2012 at 12:36

Attachments:

GoogleCodeExporter commented 9 years ago
As you may have guessed from the patches, I've now got this fully merged into 
my code and it's working really well.

Original comment by Is...@wowzers.com on 25 Feb 2012 at 12:54

GoogleCodeExporter commented 9 years ago
This issue was updated by revision dcb732241af6.

Images support HTTPS.

Original comment by justin.forest on 25 Feb 2012 at 5:59

GoogleCodeExporter commented 9 years ago
This issue was updated by revision f7cdb9b1bcbc.

Configurable image titles.

Original comment by justin.forest on 25 Feb 2012 at 5:59

GoogleCodeExporter commented 9 years ago
Thanks.

Isaac, I granted you access to the repository, you can commit directly.

Original comment by justin.forest on 25 Feb 2012 at 6:02