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

getimagesizefromstring Error #249

Closed
mendelB opened this issue Nov 13, 2017 · 5 comments
Closed

getimagesizefromstring Error #249

mendelB opened this issue Nov 13, 2017 · 5 comments

Comments

@mendelB
Copy link

mendelB commented Nov 13, 2017

First off - thanks for an awesome project!!

I've bumped into an issue where attempting to call $info->providerIcon from my Embed object resulted in an getimagesizefromstring(): read error!

The URL fed to the Embed constructor was https://www.vox.com.

e.g.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Embed\Embed;

class EmbedController extends Controller
{
    function index()
    {
	$info = Embed::create('https://www.vox.com');

    	return response()->json([
    		'icon' => $info->providerIcon,
    	]);
    }
}

image

What seems to be happening is the call to https://www.vox.com/favicon.ico (which is always made, is returning a 404 with plain text type content of "Not Found". (in contrast with most sites which would generally return some HTML)

When this string is given as an argument to the CurlDispatchers getimagesizefromstring method, it errors out for some reason.

(Oddly enough it doesn't error out if the string contains HTML of some sort (Which I imagine is why this error doesn't occur with most sites that actually return some richer text/html response content)
image
, which is probably why this doesn't break ordinarily for other sites that 404 from /favicon.ico, it only seems to freak out when it's a plain string, which in the case of Vox - it is).

This error wasn't occurring in another project where we were using Embed. And I believe this is because that project was using an older version that did not contain these changes (ref #242) which cause the onBody function to return when the data type was off, before attempting to call the getimagefromstring.

Thanks very much in advance for your time! Please let me know if there's any way I can help with a fix for this admittedly somewhat edge case.

@oscarotero
Copy link
Owner

Yes, that error should be silenced, because getimagefromstring is used not only to get the image size but also to check whether the response is a valid image or not.
I just released a new version with this bug fixed. Thanks for reporting.

@mendelB
Copy link
Author

mendelB commented Nov 13, 2017

Thanks so much @oscarotero!

@byndstd
Copy link

byndstd commented Aug 22, 2018

sorry to re open this issue but I tried with a link and I get this error : getimagesizefromstring(): Read error!
in my web and also in your demo web; link of image is your demo website with this error

https://image.ibb.co/cxrAoK/Untitl_1.png

oscarotero added a commit that referenced this issue Aug 22, 2018
@oscarotero
Copy link
Owner

Thanks for notify this. It's fixed here 87aa0ed
You can use the dev-master version until a new tag is released.

@byndstd
Copy link

byndstd commented Aug 22, 2018

Thank you for your plugin (oscarotero/Embed) the best php script ever
and also for your time you give to help with issue
+10000000

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

No branches or pull requests

3 participants