This is an HTTP question (the protocol, not HTML the document format).
Yes this is what I meant but the mail was sent.
And you solved your problem well, I never tried it like that myself ;-)
I would not write it differently.
Like the comment says, it will only work with those types recognised by ImageReadWriter, which are the most common ones, JPG, GIF and PNG.
Image/* is a wildcard matching any image type, and there are many, many more.
The current mechanism in Zinc with #accept: and #enforceAcceptContentType: true assumes a singular 'Accept' header. But indeed, technically, it is possible to specify more than one.
For example, this also works:
ZnClient new url: 'http://pharo.org/files/pharo.png <http://pharo.org/files/pharo.png>'; headerAt: 'Accept' add: ZnMimeType imageGif asString; headerAt: 'Accept' add: ZnMimeType imagePng asString; headerAt: 'Accept' add: ZnMimeType imageJpeg asString; contentReader: [ :entity | ImageReadWriter formFromStream: entity readStream ]; get.
Ah this would be better for me because like that I can probably control which exception is raised. Because we do not support image/svg
But I have to think a bit about this issue.
Another approach is to use the extension of the URL.
ZnMimeType forFilenameExtension: 'http://pharo.org/files/pharo.png <http://pharo.org/files/pharo.png>' asUrl file asFileReference extension.
It all depends at what level you want to tell your user they tried getting an unsupported file type.
Broad :) but soon you will be my user and you will have the right to complain :)
Sven
S.
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr <http://stephane.ducasse.free.fr/> / http://www.pharo.org <http://www.pharo.org/> 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France