Skip to content

Remote image download throws exception #49

Open
@patrickcarlohickman

Description

@patrickcarlohickman

If the url for a remote image does not contain a "proper" extension (e.g. seo formatted urls or urls with query strings), the remote file download functionality throws an exception:

Imagine \ Exception \ InvalidArgumentException
Saving image in "0?lm=20130905t051456" format is not supported,
please use one of the following extension: "gif", "jpeg", "png", "wbmp", "xbm"

One workaround to get the file downloaded is to add a dummy query string to the end of the file to download, such as "&x=file.jpeg". This lets the download work correctly, but then the query string and everything is part of the file name of the file on the server (file on server is "0?lm=20130905t051456&x=x.jpeg"). Additionally, the file is not accessible from the browser, as far as I have been able to tell.

Two options I see:

  • Have the IOWrapper->createFromUrl() method try to come up with a sensible filename and extension based on the curlinfo data.
  • Allow some way to set the desired file name for remotely downloaded files. This may be part of implementing proposal [Proposal] rename attachments #36 (though you'd need to be able to set the file name before downloading), or could be completely separate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions