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

handle binary data #24

Open
staabm opened this issue Aug 19, 2013 · 4 comments
Open

handle binary data #24

staabm opened this issue Aug 19, 2013 · 4 comments

Comments

@staabm
Copy link
Collaborator

staabm commented Aug 19, 2013

Hi!

I am fiddling arround how I could implement a way of binary data handling within the php-console.

e.g. I have code which open and streams a pdf, and I want the php-console to open and show the pdf in the browser when executing it..

simple example:

header('Content-Type: application/pdf');
readfile('my.pdf');

same use-case when creating images with e.g. GD and like to render them with the console.

What I tried already:
Make 'Content-Type' sending within php-consoles' index.php optional, so one can send the header from the eval'ed code. Now I get the data back from the server but I have not clue how I could put this give that binary string to the browser, to get it rendered/opened properly.

Any ideas how to achvie such thing?

@staabm
Copy link
Collaborator Author

staabm commented Aug 19, 2013

Maybe I could post the code using a regular form and let a iframe render it, but this would change how php-console works, because it renders the output in a DIV atm.

WDYT?

@Seldaek
Copy link
Owner

Seldaek commented Aug 19, 2013

IMO that is sort of on the edge of what this was made for.. It's not really a quick attempt at something if you're generating PDFs :p The only thing I can think of is to have another button than "try" which would be "raw output" or something that does a simple browser POST and only outputs the result of the eval() call so you can do what you want and get it displayed as is in the browser, then hit back if needed to change the code.

@staabm
Copy link
Collaborator Author

staabm commented Aug 19, 2013

You are right.. I won't develop such sort of code in the console, but sometimes I extract this type of code from an application and reduce it to a as simple as possible reproducible testcase.

I think it could work if I change the current code handling from AJAX to posting it to an iframe.. any objections?

@Seldaek
Copy link
Owner

Seldaek commented Aug 19, 2013

I am not sure how it would work with large inputs to the iframe, but you
can try..

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