Re: [PHP] passthru problems generating WAVs with mpg123
I'm SURE you've got a good reason, but why are you wanting to generate a WAV on demand? The loss in file quality occurs going from WAV MP3, so then later going back to WAV would only result in a bigger file size, with ZERO benefit in audio quality. Just asking :) Justin on 26/10/02 4:53 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: I've written a little script for VoiceXML applications to generate a WAV from an MP3 on demand: #file wavwrapper.php ? header('Content-Type: audio/wav'); $filename = $_GET['filename']; $mp3dir=/var/www/mp3s/; $playercmd=/usr/local/bin/mpg123 -m -w - -q -4 --8bit; passthru($playercmd $mp3dir/$filename 2 /tmp/playererror); ? I request it as wavwrapper?filename=song.mp3, and the browser reads the MIME type properly, prompts me to play or download the song. I download it, and save it as a WAV file. However, Mozilla downloads about 1.5M of data, saves it all to a file, and then displays the downloaded size as 1k. And then when I try to play it back, it won't play; it's like an empty file. Same thing happens if I try to play it directly. But if I redirect the output of mpg123 from standard out (so it goes across the web connection) to a file and then download the file, the file plays just fine. I figure there's something to do with the way PHP dumps back the binary data that just isn't working right, but I don't know what it is. Anyone have any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passthru Problems
I believe there is header called "Content-disposition: filename.pdf" which is defined in the proper RFC. And as far as I know some browsers don't respect it. Search the list for it, you should find allot of info. Mike -Original Message- From: Jason Mowat [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 12, 2001 12:46 PM To: [EMAIL PROTECTED] Subject: [PHP] passthru Problems Greetings, I am having a small problem displaying PDF files to my users via passthru. This is the situation: I have a bunch of PDF files on my server directory. I show the user a listing of the PDF files they can view, and allow them to hyperlink click on the PDF they wish to browse. When the user clicks the link, I execute a header() and then my passthru on my PDF file. The code is essentially: header("Content-type: application/pdf"); passthru($pdf_file); Now, my problem is that the title of the HTML window that pops up is of the URL path. I want to set the title to something meaningful (like the name of the PDF file the user is looking at). But, if I try to print a "TITLEPDF File/TITLE" after the header, my PDF document does not show up (it shows the raw encoding of the PDF document). Does anyone have any suggestions to allow me to show a title on a header/passthru page? Is there a better way to do this? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passthru Problems
Greets, Just to elaborate: I want my user to be able to click on a hyperlink that points to my PDF file, and have a new window pop up, displaying the contents of the PDF file in the browser window (without prompting if they should save the file) as well as set the HTML TITLE tag to the name of the report. My passthru() function works fine, when I send a header() of PDF first, and then dump the raw PDF out. But, I cannot set any HTML properties with tags (like TITLE); it doesn't show the PDF in PDF format then, it shows it all raw encoded. Hope that helps clarifying my wants and needs :-) Cheers, Jason ""Jason Mowat"" [EMAIL PROTECTED] wrote in message 9b4lso$2gb$[EMAIL PROTECTED]">news:9b4lso$2gb$[EMAIL PROTECTED]... Greetings, I am having a small problem displaying PDF files to my users via passthru. This is the situation: I have a bunch of PDF files on my server directory. I show the user a listing of the PDF files they can view, and allow them to hyperlink click on the PDF they wish to browse. When the user clicks the link, I execute a header() and then my passthru on my PDF file. The code is essentially: header("Content-type: application/pdf"); passthru($pdf_file); Now, my problem is that the title of the HTML window that pops up is of the URL path. I want to set the title to something meaningful (like the name of the PDF file the user is looking at). But, if I try to print a "TITLEPDF File/TITLE" after the header, my PDF document does not show up (it shows the raw encoding of the PDF document). Does anyone have any suggestions to allow me to show a title on a header/passthru page? Is there a better way to do this? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passthru Problems
You need to use a frameset to do what you want. the problem is the browser will only launch the Acrobat control if it receives the content type app/pdf, an html page uses the content type text/html. your links should point to another page that outputs something like the following based on input of the pdf file path and name ( HTML shamelessly stolen from http://www.php4.net/ :-) HTML HEAD TITLE?php echo $your_title ?/TITLE FRAMESET rows="100%,*" frameborder="0"framespacing="0" border="0" align=CENTER FRAME SRC="?php echo $your_pdf_file_path ?" Name="pdf" scrolling="auto" FRAME SRC="empty.htm" Name="invisible" scrolling="no" /FRAMESET /HTML if you are using track_vars and don't have the auto globalizing of form elements, use $HTTP_GET_VARS[ 'your_title'] $HTTP_GET_VARS[ 'your_pdf_file_path '] or $HTTP_POST_VARS[ 'your_title'] $HTTP_POST_VARS[ 'your_pdf_file_path '] depending on your form method morgan At 03:20 PM 4/12/2001, you wrote: Greets, Just to elaborate: I want my user to be able to click on a hyperlink that points to my PDF file, and have a new window pop up, displaying the contents of the PDF file in the browser window (without prompting if they should save the file) as well as set the HTML TITLE tag to the name of the report. My passthru() function works fine, when I send a header() of PDF first, and then dump the raw PDF out. But, I cannot set any HTML properties with tags (like TITLE); it doesn't show the PDF in PDF format then, it shows it all raw encoded. Hope that helps clarifying my wants and needs :-) Cheers, Jason ""Jason Mowat"" [EMAIL PROTECTED] wrote in message 9b4lso$2gb$[EMAIL PROTECTED]">news:9b4lso$2gb$[EMAIL PROTECTED]... Greetings, I am having a small problem displaying PDF files to my users via passthru. This is the situation: I have a bunch of PDF files on my server directory. I show the user a listing of the PDF files they can view, and allow them to hyperlink click on the PDF they wish to browse. When the user clicks the link, I execute a header() and then my passthru on my PDF file. The code is essentially: header("Content-type: application/pdf"); passthru($pdf_file); Now, my problem is that the title of the HTML window that pops up is of the URL path. I want to set the title to something meaningful (like the name of the PDF file the user is looking at). But, if I try to print a "TITLEPDF File/TITLE" after the header, my PDF document does not show up (it shows the raw encoding of the PDF document). Does anyone have any suggestions to allow me to show a title on a header/passthru page? Is there a better way to do this? Cheers, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]