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

FR: expose 'createImage' so can be used w/ other filesystems #258

Closed
edalzell opened this issue Dec 30, 2017 · 5 comments
Closed

FR: expose 'createImage' so can be used w/ other filesystems #258

edalzell opened this issue Dec 30, 2017 · 5 comments

Comments

@edalzell
Copy link

I'm trying to use this great library in a CMS that uses PHP League's Flysystem, so I need to be able to get the contents of the created image to pass into something like this $filesystem->write($path, file_get_contents($temp_path));

To do this, all that needs to happen is to change createImage from protected or public.

@mikehaertl
Copy link
Owner

Would it help to add a toString() method instead, which returns the raw file content? See https://github.com/mikehaertl/phpwkhtmltopdf/blob/master/src/Pdf.php#L197.

I'd rather prefer to have the same interface on both classes, Pdf and Image.

@edalzell
Copy link
Author

edalzell commented Dec 30, 2017

It’s not text data though, it’s binary data.

But yes as long as there’s a way to retrieve the raw binary data, that would work. However I don’t need the saveAs method either, I need a way to create the image (into temp I guess) and get the either that temp location or the raw data. That’s why I suggested jut exposing createimage

@mikehaertl
Copy link
Owner

mikehaertl commented Dec 31, 2017

@edalzell I've just pushed a change to master where toString() is implemented. Does this solve your problem?

You don't have to worry about temporary files. This is handled by our php-tmpfile class which will auto-delete any temporary files - unless there was an error.

@edalzell
Copy link
Author

So awesome, thanks! I'll update my code when you release so that my customer can get the right code when he installs my addon.

@mikehaertl
Copy link
Owner

mikehaertl commented Jan 1, 2018

I've released 2.3.0 containing this change. Thanks for the suggestion!

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