On Thu, 6 Nov 2014 06:38:40 -0800 (PST) Hoai Ninh wrote:

I am going to save image from url
but the problem is that I dont know how to get the image extensions
to exactly save to this kind of image type
eg: http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png
I want to save to file name by creating like this: file_name + "." +
It's not quite clear what really about you're asking: do you want to
extract the extension of the last path component of a known URI (like
that one you've cited) or do you want to somehow "know" an extension
for a file to save an image given its MIME type (like in image/png)?

The first task can be carried out using the Ext() function of the
path/filepath package while the latter can be done using a lookup map
which associates known MIME types with extension strings.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 5 | next ›
Discussion Overview
groupgolang-nuts @
postedNov 6, '14 at 2:38p
activeNov 6, '14 at 4:37p



site design / logo © 2021 Grokbase