Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagick throws "Invalid filename provided" when provided a URL. #6908

Open
getsource opened this issue Mar 14, 2016 · 4 comments
Open

Imagick throws "Invalid filename provided" when provided a URL. #6908

getsource opened this issue Mar 14, 2016 · 4 comments

Comments

@getsource
Copy link

HHVM Version

HipHop VM 3.12.1 (rel)

Standalone code, or other way to reproduce the problem

$image = new Imagick("http(s)://any.url/image.jpg");

Expected result

Imagick object is instantiated.

Actual result

Exception ImagickException with message 'Invalid filename provided' in ...

Ran into this with a failed test when fixing https://core.trac.wordpress.org/ticket/35973 for WordPress 4.5. Previously, a bug had kept WordPress from selecting Imagick as its image editing library, hiding this particular issue. The image URL used in that test is https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg.

Possibly Related: #3451

@apeabody
Copy link
Contributor

I took a quick look under the hood and the Imagick:: constructor verifies and then provides the string to imagemagick's MagickSetImageFilename() which only accepts a filename, not a URL.

My initial thought is it might be possible to hand off MagickReadImageFile() a php stream of the URL as it will take a file descriptor - however I would first need to verify if HHVM's stream properly support http(s), I seem to remember it doesn't?

@jimyaghi
Copy link
Contributor

jimyaghi commented Sep 4, 2016

i've had the same issue with this. exact same bug. the only work around i found for wordpress and hhvm with remote stream (i'm using a custom stream wrapper for google cloud!!) is to switch to gd by using the filter:
add_filter( 'wp_image_editors', function($ar) {
return ['WP_Image_Editor_GD'];
}

The gd version loads the file using file_get_content into memory which is not as desirable. i tried to see if i can fix the issue by patching HHVM but it went over my head. lol so i'm sticking with GD for now.

@mlecoq
Copy link

mlecoq commented Sep 26, 2016

Same issue with prestashop and https://github.com/firstred/mdimagemagick

@Aldmors
Copy link

Aldmors commented Jan 31, 2023

still problem alive :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants