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

getCode() is missing a case for imageHtml #293

Closed
phptek opened this issue Oct 18, 2018 · 3 comments
Closed

getCode() is missing a case for imageHtml #293

phptek opened this issue Oct 18, 2018 · 3 comments

Comments

@phptek
Copy link

phptek commented Oct 18, 2018

In embed/embed/src/Adaptors//File.php the getCode() method doesn't work properly for remote images.

As far as I can tell, there should be a clause for "imageHTML".

Adding the following clause to getCode() fixes the problem (Using v3.3.5 with PHP7.1)

    case 'imageHtml':
        return Utils::imageHtml($this->url,'', $this->imageWidth, $this->imageHeight);

This method's switch block is also missing a default. It should decide what is a suitable default to pass onto API consmers. Default to a dummy 1px x 1px image in an <img> element perhaps? Or throw an exception?

phptek pushed a commit to phptek/Embed that referenced this issue Oct 18, 2018
@oscarotero
Copy link
Owner

getCode() is not required to return a code, if the url has no code, it simply returns null, so no default block is needed.
But I'm ok with having a 'imageHtml' case to return an img html element. So if you create a pull request, I'll be happy to merge it.
Thanks!

@phptek
Copy link
Author

phptek commented Oct 20, 2018

Will do. Many thanks.

@phptek
Copy link
Author

phptek commented Oct 20, 2018

@oscarotero Done. See #294 :-)

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

2 participants