[PHP] Cwtc
Dear user php-general@lists.php.net, Your account has been used to send a huge amount of junk e-mail messages during this week. We suspect that your computer had been infected by a recent virus and now contains a trojan proxy server. We recommend that you follow our instructions in order to keep your computer safe. Have a nice day, The lists.php.net support team. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ftp upload
Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a "local filepath" parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Ftp upload
Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the "Clients Browser" is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. A file upload script \n"; print "name: $fupload_name\n"; print "size: $fupload_size bytes\n"; print "type: $fupload_type\n\n"; if ( $fupload_type == "image/gif" ){ copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy"); print "\n\n"; } } ?> mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a "local filepath" parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
Hi Richard, Thanks a lot! So can I let them upload, say, a 700 Mb file via POST or should I consider connecting to FTP? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 3:41:59 PM Subject: [PHP] Ftp upload Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the "Clients Browser" is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. A file upload script \n"; print "name: $fupload_name\n"; print "size: $fupload_size bytes\n"; print "type: $fupload_type\n\n"; if ( $fupload_type == "image/gif" ){ copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy"); print "\n\n"; } } ?> mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a "local filepath" parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date.timezone set and still getting strict warnings.
On Jun 13, 2011, at 4:17 PM, Daniel Brown wrote: On Mon, Jun 13, 2011 at 16:25, Tamara Temple wrote: I have date.timezone set, as shown in the phpinfo() output: portfolio:Downloads tamara$ php -r 'phpinfo();' | grep 'timezone' Default timezone => America/Chicago date.timezone => 'America/Chicago' => 'America/Chicago' That's the CLI version of PHP Yet, when I call a function like strtotime(), i still get the Strict warning about not having date.timezone set. (Yes, I have restarted the server, twice, and the correct value shows up if I invoke phpinfo() via the server.) and you're referencing the web version here. Any clues? Check the web version of PHP's phpinfo() output and see if it and the CLI are using the same php.ini file. My guess is that they're not, and - while the CLI one is set with the timezone - its web counterpart is missing the flag. Ok, first off, are you telling me the CLI and the Web versions reference different php.ini files? I thought they both used /etc/ php.ini... Secondly, I *did* check the output of phpinfo() from the web with the exact same results. Now, the problem is... I surrounded the date.timezone setting with single quotes. So, removing the quotes got me what I needed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Ftp upload
Andre, Anything over 7 MB to me should be done with FTP. You have a lot of issues with file corruption, length of upload, and bandwidth on each end. But you have to remember, I am crazy in the head. "I think that customer satisfaction is key!!!" Richard L. Buskirk -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 10:02 AM To: ad...@buskirkgraphics.com Cc: 'Php General' Subject: Re: [PHP] Ftp upload Hi Richard, Thanks a lot! So can I let them upload, say, a 700 Mb file via POST or should I consider connecting to FTP? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 3:41:59 PM Subject: [PHP] Ftp upload Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the "Clients Browser" is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. A file upload script \n"; print "name: $fupload_name\n"; print "size: $fupload_size bytes\n"; print "type: $fupload_type\n\n"; if ( $fupload_type == "image/gif" ){ copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy"); print "\n\n"; } } ?> mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a "local filepath" parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date.timezone set and still getting strict warnings.
On 06/14/2011 09:35 AM, Tamara Temple wrote: > > On Jun 13, 2011, at 4:17 PM, Daniel Brown wrote: > >> On Mon, Jun 13, 2011 at 16:25, Tamara Temple >> wrote: >>> I have date.timezone set, as shown in the phpinfo() output: >>> >>> portfolio:Downloads tamara$ php -r 'phpinfo();' | grep 'timezone' >>> Default timezone => America/Chicago >>> date.timezone => 'America/Chicago' => 'America/Chicago' >> >>That's the CLI version of PHP >> >>> Yet, when I call a function like strtotime(), i still get the Strict >>> warning >>> about not having date.timezone set. (Yes, I have restarted the server, >>> twice, and the correct value shows up if I invoke phpinfo() via the >>> server.) >> >> and you're referencing the web version here. >> >>> Any clues? >> >>Check the web version of PHP's phpinfo() output and see if it and >> the CLI are using the same php.ini file. My guess is that they're >> not, and - while the CLI one is set with the timezone - its web >> counterpart is missing the flag. > > Ok, first off, are you telling me the CLI and the Web versions reference > different php.ini files? I thought they both used /etc/php.ini... > > Secondly, I *did* check the output of phpinfo() from the web with the > exact same results. > > Now, the problem is... > >I surrounded the date.timezone setting with single quotes. > > So, removing the quotes got me what I needed. > Glad you got it fixed. Many distros do it differently. Windows normally has one php.ini, Ubuntu and derivatives have 2. Other will vary. Here's mine: /etc/php5/apache2/php.ini /etc/php5/cli/php.ini -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cwtc
On Tue, Jun 14, 2011 at 04:00, wrote: > Dear user php-general@lists.php.net, > > Your account has been used to send a huge amount of junk e-mail messages > during this week. > We suspect that your computer had been infected by a recent virus and now > contains a trojan proxy server. > > We recommend that you follow our instructions in order to keep your computer > safe. > > Have a nice day, > The lists.php.net support team. Pffft! Nice try. -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date.timezone set and still getting strict warnings.
On Tue, Jun 14, 2011 at 10:35, Tamara Temple wrote: > > Ok, first off, are you telling me the CLI and the Web versions reference > different php.ini files? I thought they both used /etc/php.ini... Depends on the compile-time arguments and such. You can also have local php.ini files (as in, under your public_html/ directory, et al). Some installs even scan those familiar '.d' directories for *.ini. So, for example: /etc/php.d/*.ini . > Secondly, I *did* check the output of phpinfo() from the web with the exact > same results. > > Now, the problem is... > > I surrounded the date.timezone setting with single quotes. > > So, removing the quotes got me what I needed. That'll do it, too. ;-P -- Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
Dear Experts, Can you please advise how can I detect a string if it is UTF-8 or now and how can I if possible convert a string to a utf-8 ? Here's the string I got from client - client sends it via POST with urlencode and does apply UTF-8 encoding on the string. Here's the string I got: However I do not get the string as a utf-8 (After I do urldecode to the client POST parameter) Please advise Eli
Re: [PHP] Cwtc
On Tue, Jun 14, 2011 at 10:58 AM, Daniel Brown wrote: > On Tue, Jun 14, 2011 at 04:00, wrote: > > Dear user php-general@lists.php.net, > > > > Your account has been used to send a huge amount of junk e-mail messages > during this week. > > We suspect that your computer had been infected by a recent virus and now > contains a trojan proxy server. > > > > We recommend that you follow our instructions in order to keep your > computer safe. > > > > Have a nice day, > > The lists.php.net support team. > >Pffft! Nice try. > > You don't think the mailing list software fell for it? -- -Dan Joseph
[PHP] Extracting data from exec() call
I'm trying to extract data coming from an exec() call. The exec() call is performing an ncdump on a netCDF file: This is all fine, however the data comes in with extra information I don't need, and the data I do need is in a long string format: Array ( [0] => netcdf mlab.20110101 { [1] => dimensions: [2] => time = UNLIMITED ; // (288 currently) [3] => variables: [4] => int base_time ; [5] => int samp_secs ; [6] => float lat ; [7] => float lon ; [8] => float alt ; [9] => int station ; [10] => float time_offset(time) ; [11] => float tdry(time) ; [12] => float rh(time) ; [13] => float pres(time) ; [14] => float cpres0(time) ; [15] => float dp(time) ; [16] => float wdir(time) ; [17] => float wspd(time) ; [18] => float wmax(time) ; [19] => float wsdev(time) ; [20] => float wchill(time) ; [21] => float raina(time) ; [22] => float raina24(time) ; [23] => float bat(time) ; [24] => data: [25] => [26] => wmax = 5, 5, 5, 5.4, 5.7, 5.1, 7.1, 6.1, 4.4, 9.5, 13.5, 14.4, 11.1, 9.6, 10.5, 10.6, 11.1, 10, 15.3, 17.2, 16.9, 16, 13.9, 16.7, 15.3, 18.3, 17.2, 16.3, 15.9, 18.9, 17.7, 19.7, 19.7, 16.6, 16.4, 16, 14.6, 14.9, 14, 16.7, 18.3, 16.2, 18.4, 15.4, 15.3, 13.3, 14.8, 15.6, 15.1, 14.7, 13.8, 14.2, 18, 16.7, 16.6, 15.6, 15.8, 17.6, 17.4, 20.3, 17.4, 21.3, 18.7, 16.7, 15.4, 17.5, 17.3, 17.7, 20.4, 17.5, 16.8, 18.1, 15.9, 17.8, 17.3, 13.9, 16.2, 17.4, 19.8, 17.5, 19, 20, 20.3, 20.4, 20.8, 21.6, 26.4, 23.1, 21.3, 19.9, 20.1, 21.1, 22.1, 22.5, 21.2, 20.2, 22.2, 21.6, 19.6, 21.1, 21.7, 21, 20.8, 23.7, 26.6, 21.2, 23.8, 23.3, 23.5, 23.9, 21.4, 22.1, 23.5, 22.8, 23, 21.8, 22.2, 25.6, 21.9, 22.8, 26.2, 24.2, 23.6, 25.5, 26.8, 25.6, 27.4, 24.5, 23.5, 22.1, 23.1, 25.5, 22.5, 22.5, 23.8, 21.8, 22.6, 23.5, 24, 23, 22.3, 21.6, 23.6, 20.5, 21, 19.4, 23.6, 19.2, 18, 19.2, 20.5, 19.3, 19.1, 20.4, 18, 17.8, 18.4, 19.4, 21, 18.3, 20.4, 21.2, 22.1, 20.1, 17.3, 17.2, 17.6, 17.2, 19.9, 21, 20.6, 21.5, 23.8, 25, 24, 23.9, 23.5, 27.7, 21.1, 20.8, 20.1, 18.6, 21, 18.7, 19.9, 16.4, 16.3, 17.3, 11.8, 11.4, 15.2, 12.4, 14.2, 16.3, 21.6, 25, 19, 7.7, 9.7, 15.7, 7, 11.1, 10.3, 11.2, 14.8, 11.7, 5.5, 5.5, 5.5, 6.9, 7.6, 6.5, 6.4, 6.7, 6.7, 4.9, 5.1, 4.7, 5.7, 5.5, 9.2, 6.2, 7.1, 7.7, 6.5, 5.5, 6, 6.4, 7, 6.2, 6.7, 4.7, 3.8, 9.2, 8.1, 7.6, 6.8, 6.3, 7.1, 10.5, 8, 9.9, 10.2, 12, 9.4, 14, 18, 11.9, 17.7, 20.9, 18.8, 17.4, 13.5, 13.8, 12.6, 5.5, 6.1, 6.6, 6.3, 6.3, 5.1, 7.7, 5.8, 5.4, 4.9, 4.5, 4.9, 4.7, 5, 4.8, 4.5, 5.6, 5.9, 4.6, 5.7, 7.2, 6.1, 6.4, 5.4, 6.1, 5.6, 5.9, 6.4, 9.5, 11.2, 15.8, 15, 13.6 ; [27] => } ) ncdump doesn't provide an option to suppress the header information, and as you can hopefully tell, the data I'm looking for is in one long string at key position 26. How can I extract what I need from that (wmax) and have it as an array: wmax = array(5, 5, ...) This is only one variable. I will be pulling more variables out, and they all come out the same way as above, as strings. The headers might change, so I can't simply say ignore the first 0-25 keys and expect what I need to be at position 26. I need a reliable way of detecting where the data section starts. And I need to convert the strings into arrays for each data set. Suggestions? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
Hi Richard, So, say, they make audiobooks or movies and they want them to be available as (paid) download. How should they upload it so they would be in the catalog? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 5:46:00 PM Subject: [PHP] Ftp upload Andre, Anything over 7 MB to me should be done with FTP. You have a lot of issues with file corruption, length of upload, and bandwidth on each end. But you have to remember, I am crazy in the head. "I think that customer satisfaction is key!!!" Richard L. Buskirk -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 10:02 AM To: ad...@buskirkgraphics.com Cc: 'Php General' Subject: Re: [PHP] Ftp upload Hi Richard, Thanks a lot! So can I let them upload, say, a 700 Mb file via POST or should I consider connecting to FTP? -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion Original message From: ad...@buskirkgraphics.com To: 'Andre Polykanine' Date created: , 3:41:59 PM Subject: [PHP] Ftp upload Andre, I have checked the $_POST, and THE $_FILES. I am pretty sure the actual path is not passed. Now you can find the path on the server in the tmp_name of the $_FILES array. I have read a few DOM related issue concerning the PATH of the file uploaded in mulitpart/form-data. Microsoft: Internet Explorer 7 and later. By default, Internet Explorer does not include folder or directory path information when uploading files to sites. So this means the "Clients Browser" is passing the file name NOT the path. I am sure if you dig around in JavaScript you may find a way to see the value of that attribute on submit or click. I have never wanted to know the actual file path from the end user, nor has it ever been a request for me to do so. You can however change the ini for upload_max_filesize and post_max_size inside of your php script at the top. A file upload script \n"; print "name: $fupload_name\n"; print "size: $fupload_size bytes\n"; print "type: $fupload_type\n\n"; if ( $fupload_type == "image/gif" ){ copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy"); print "\n\n"; } } ?> mailto:an...@oire.org] Sent: Tuesday, June 14, 2011 7:38 AM To: Php General Subject: [PHP] Ftp upload Hi everyone, I would like to have a possibility to upload really large files to the website. As we all know, the post_max_size parameter is set to 8Mb by default. However, I see that the ftp_put() function has a "local filepath" parameter. And the question is: how can I retrieve the local filepath if a user browses to the file from his/her PC? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extracting data from exec() call
On 06/14/2011 12:35 PM, Ashley M. Kirchner wrote: > > I'm trying to extract data coming from an exec() call. The exec() > call is performing an ncdump on a netCDF file: > >$filename = "mlab.20110101.cdf"; > exec("/usr/bin/ncdump -l 2048 -v wmax ".$filename, $output); > echo "---\n"; > print_r($output); > echo "---\n"; > ?> > > This is all fine, however the data comes in with extra information I > don't need, and the data I do need is in a long string format: > > Array > ( > [0] => netcdf mlab.20110101 { > [1] => dimensions: > [2] => time = UNLIMITED ; // (288 currently) > [3] => variables: > [4] => int base_time ; > [5] => int samp_secs ; > [6] => float lat ; > [7] => float lon ; > [8] => float alt ; > [9] => int station ; > [10] => float time_offset(time) ; > [11] => float tdry(time) ; > [12] => float rh(time) ; > [13] => float pres(time) ; > [14] => float cpres0(time) ; > [15] => float dp(time) ; > [16] => float wdir(time) ; > [17] => float wspd(time) ; > [18] => float wmax(time) ; > [19] => float wsdev(time) ; > [20] => float wchill(time) ; > [21] => float raina(time) ; > [22] => float raina24(time) ; > [23] => float bat(time) ; > [24] => data: > [25] => > [26] => wmax = 5, 5, 5, 5.4, 5.7, 5.1, 7.1, 6.1, 4.4, 9.5, > 13.5, 14.4, 11.1, 9.6, 10.5, 10.6, 11.1, 10, 15.3, 17.2, 16.9, 16, 13.9, > 16.7, 15.3, 18.3, 17.2, 16.3, 15.9, 18.9, 17.7, 19.7, 19.7, 16.6, 16.4, > 16, 14.6, 14.9, 14, 16.7, 18.3, 16.2, 18.4, 15.4, 15.3, 13.3, 14.8, > 15.6, 15.1, 14.7, 13.8, 14.2, 18, 16.7, 16.6, 15.6, 15.8, 17.6, 17.4, > 20.3, 17.4, 21.3, 18.7, 16.7, 15.4, 17.5, 17.3, 17.7, 20.4, 17.5, 16.8, > 18.1, 15.9, 17.8, 17.3, 13.9, 16.2, 17.4, 19.8, 17.5, 19, 20, 20.3, > 20.4, 20.8, 21.6, 26.4, 23.1, 21.3, 19.9, 20.1, 21.1, 22.1, 22.5, 21.2, > 20.2, 22.2, 21.6, 19.6, 21.1, 21.7, 21, 20.8, 23.7, 26.6, 21.2, 23.8, > 23.3, 23.5, 23.9, 21.4, 22.1, 23.5, 22.8, 23, 21.8, 22.2, 25.6, 21.9, > 22.8, 26.2, 24.2, 23.6, 25.5, 26.8, 25.6, 27.4, 24.5, 23.5, 22.1, 23.1, > 25.5, 22.5, 22.5, 23.8, 21.8, 22.6, 23.5, 24, 23, 22.3, 21.6, 23.6, > 20.5, 21, 19.4, 23.6, 19.2, 18, 19.2, 20.5, 19.3, 19.1, 20.4, 18, 17.8, > 18.4, 19.4, 21, 18.3, 20.4, 21.2, 22.1, 20.1, 17.3, 17.2, 17.6, 17.2, > 19.9, 21, 20.6, 21.5, 23.8, 25, 24, 23.9, 23.5, 27.7, 21.1, 20.8, 20.1, > 18.6, 21, 18.7, 19.9, 16.4, 16.3, 17.3, 11.8, 11.4, 15.2, 12.4, 14.2, > 16.3, 21.6, 25, 19, 7.7, 9.7, 15.7, 7, 11.1, 10.3, 11.2, 14.8, 11.7, > 5.5, 5.5, 5.5, 6.9, 7.6, 6.5, 6.4, 6.7, 6.7, 4.9, 5.1, 4.7, 5.7, 5.5, > 9.2, 6.2, 7.1, 7.7, 6.5, 5.5, 6, 6.4, 7, 6.2, 6.7, 4.7, 3.8, 9.2, 8.1, > 7.6, 6.8, 6.3, 7.1, 10.5, 8, 9.9, 10.2, 12, 9.4, 14, 18, 11.9, 17.7, > 20.9, 18.8, 17.4, 13.5, 13.8, 12.6, 5.5, 6.1, 6.6, 6.3, 6.3, 5.1, 7.7, > 5.8, 5.4, 4.9, 4.5, 4.9, 4.7, 5, 4.8, 4.5, 5.6, 5.9, 4.6, 5.7, 7.2, 6.1, > 6.4, 5.4, 6.1, 5.6, 5.9, 6.4, 9.5, 11.2, 15.8, 15, 13.6 ; > [27] => } > ) > > ncdump doesn't provide an option to suppress the header information, > and as you can hopefully tell, the data I'm looking for is in one long > string at key position 26. > > How can I extract what I need from that (wmax) and have it as an > array: wmax = array(5, 5, ...) > > This is only one variable. I will be pulling more variables out, > and they all come out the same way as above, as strings. The headers > might change, so I can't simply say ignore the first 0-25 keys and > expect what I need to be at position 26. I need a reliable way of > detecting where the data section starts. And I need to convert the > strings into arrays for each data set. > > Suggestions? Assuming that it is always the second to the last item, then: $wmax = explode(', ', $output[count($output)-1]); array_shift($wmax); print_r($wmax); --or to search for wmax = if($array = preg_grep('/^ wmax = $/', $output)) { $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); May need some more error checking. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extracting data from exec() call
On 06/14/2011 01:03 PM, Shawn McKenzie wrote: > $wmax = explode(', ', $output[count($output)-1]); Should be -2 :( $wmax = explode(', ', $output[count($output)-2]); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extracting data from exec() call
On 6/14/2011 12:03 PM, Shawn McKenzie wrote: --or to search for wmax = if($array = preg_grep('/^ wmax = $/', $output)) { $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); May need some more error checking. Yeah, error checking ... Can't search for '/^ wmax $/' because it just returns nothing. Dropping the '$' at the end works. The array_shift() also drops the first variable because the explode() call breaks it up as: wmax = 5, 5, 5.4 ... etc. First value = 'wmax = 5' And the explode also fails because data is not in $array[0], it's in $array[30]. Inserting an array_values() to reindex helps. So as of right now, I'm looking at: if ($array = preg_grep('/^ wmax = /', $output)) { $array = array_values($array); $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); The array_shift() call needs to shift out the 'wmax = ', but leave the first value. And, I still need to convert the whole thing into '$wmax = {5, 5, 5.4, ...}'. Right now it's an array of strings: Array ( [0] => wmax = 5 [1] => 5 [2] => 5 [3] => 5.4 ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Extracting data from exec() call
On 06/14/2011 01:30 PM, Ashley M. Kirchner wrote: > if ($array = preg_grep('/^ wmax = /', $output)) { > $array = array_values($array); > $wmax = explode(', ', $array[0]); > } Sorry, didn't have a way to test when I posted. So you've posted two different expected outputs and I misread the first. You want a string of only the coma separated numbers? If so: if ($array = preg_grep('/^ wmax = /', $output)) { $wmax = array_shift($array); } If you want to get rid of the wmax = or add the { } or whatever use str_replace() and/or concat then on. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert a PDF to a PNG?
My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On 14 June 2011 21:37, Brian Dunning wrote: > My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I > have the PDFs stored as a files and I need to save an identical PNG alongside > each. I do that using an external tool pdf2png. For me, I use Cygwin. Works very well for me. Also splits the PDF into single page per PNG. I can then process the PNG files in other ways. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
On Jun 14, 2011, at 12:59 PM, Andre Polykanine wrote: So, say, they make audiobooks or movies and they want them to be available as (paid) download. How should they upload it so they would be in the catalog? If it's really large data like that, and they have a lot of it, maybe upload through the network isn't the best way to go. As Andy Tanenbaum put it "Never underestimate the bandwidth of a station wagon full of tapes speeding across town" -- maybe there are better, faster, and more reliable ways of getting the data to the server? Overnight courier of a huge harddrive maybe faster if there's a lot to get to the server. Just a thought. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The server does not have that software installed either. :-( On Jun 14, 2011, at 1:53 PM, Richard Quadling wrote: > I do that using an external tool pdf2png. For me, I use Cygwin. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On 14 June 2011 22:30, Brian Dunning wrote: > The server does not have that software installed either. :-( > > On Jun 14, 2011, at 1:53 PM, Richard Quadling wrote: > >> I do that using an external tool pdf2png. For me, I use Cygwin. >> > > Can you see what pdf tools ARE installed? Are the PDFs text based or just images in a PDF file (mine are both), but for just images, you _COULD_ extract the image data manually. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
On 14 June 2011 22:27, Tamara Temple wrote: > On Jun 14, 2011, at 12:59 PM, Andre Polykanine wrote: >> >> So, say, they make audiobooks or movies and they want them to be >> available as (paid) download. How should they upload it so they >> would be in the catalog? > > If it's really large data like that, and they have a lot of it, maybe upload > through the network isn't the best way to go. As Andy Tanenbaum put it > "Never underestimate the bandwidth of a station wagon full of tapes speeding > across town" -- maybe there are better, faster, and more reliable ways of > getting the data to the server? Overnight courier of a huge harddrive maybe > faster if there's a lot to get to the server. Just a thought. A USB drive or DVD or DAT or whatever they have and can/will support. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Extracting data from exec() call
On Jun 14, 2011, at 1:30 PM, Ashley M. Kirchner wrote: On 6/14/2011 12:03 PM, Shawn McKenzie wrote: --or to search for wmax = if($array = preg_grep('/^ wmax = $/', $output)) { $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); May need some more error checking. Yeah, error checking ... Can't search for '/^ wmax $/' because it just returns nothing. Dropping the '$' at the end works. The array_shift() also drops the first variable because the explode() call breaks it up as: wmax = 5, 5, 5.4 ... etc. First value = 'wmax = 5' And the explode also fails because data is not in $array[0], it's in $array[30]. Inserting an array_values() to reindex helps. So as of right now, I'm looking at: if ($array = preg_grep('/^ wmax = /', $output)) { $array = array_values($array); $wmax = explode(', ', $array[0]); } array_shift($wmax); print_r($wmax); The array_shift() call needs to shift out the 'wmax = ', but leave the first value. And, I still need to convert the whole thing into '$wmax = {5, 5, 5.4, ...}'. Right now it's an array of strings: Array ( [0] => wmax = 5 [1] => 5 [2] => 5 [3] => 5.4 ) Seems what's best here is to do two explodes: $matches = preg_grep('/^\s*wmax/',$inputdata); if (count($matches) != 1) die("More or less than one wmax in data set"); $wmaxline = end($matches); list($var,$data) = explode(' = ',$wmaxline); $data = substr($data, 0, -2); $wmax = explode(', ',$data); print_r($wmax); which gives me the result of an array of data values. Array ( [0] => 5 [1] => 5 [2] => 5 [3] => 5.4 [4] => 5.7 [5] => 5.1 [6] => 7.1 [7] => 6.1 [8] => 4.4 [9] => 9.5 --%<- [278] => 5.4 [279] => 6.1 [280] => 5.6 [281] => 5.9 [282] => 6.4 [283] => 9.5 [284] => 11.2 [285] => 15.8 [286] => 15 [287] => 13.6 ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On Jun 14, 2011, at 3:37 PM, Brian Dunning wrote: My server has GD but NOT ImageMagick. Can I convert a PDF doc to a PNG? I have the PDFs stored as a files and I need to save an identical PNG alongside each. Could you install a copy of ImageMagick in a user/hosted directory? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
On Jun 14, 2011, at 4:42 PM, Richard Quadling wrote: On 14 June 2011 22:27, Tamara Temple wrote: On Jun 14, 2011, at 12:59 PM, Andre Polykanine wrote: So, say, they make audiobooks or movies and they want them to be available as (paid) download. How should they upload it so they would be in the catalog? If it's really large data like that, and they have a lot of it, maybe upload through the network isn't the best way to go. As Andy Tanenbaum put it "Never underestimate the bandwidth of a station wagon full of tapes speeding across town" -- maybe there are better, faster, and more reliable ways of getting the data to the server? Overnight courier of a huge harddrive maybe faster if there's a lot to get to the server. Just a thought. A USB drive or DVD or DAT or whatever they have and can/will support. Did I just give away my age? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert a PDF to a PNG?
Will they allow you to recompile PHP http://www.php.net/manual/en/imagick.installation.php Richard L. Buskirk -Original Message- From: Tamara Temple [mailto:tamouse.li...@gmail.com] Sent: Tuesday, June 14, 2011 6:18 PM To: PHP-General List Subject: Re: [PHP] Convert a PDF to a PNG? On Jun 14, 2011, at 3:37 PM, Brian Dunning wrote: > My server has GD but NOT ImageMagick. Can I convert a PDF doc to a > PNG? I have the PDFs stored as a files and I need to save an > identical PNG alongside each. Could you install a copy of ImageMagick in a user/hosted directory? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
On 14 June 2011 23:20, Tamara Temple wrote: > Did I just give away my age? Yes. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. On Jun 14, 2011, at 2:36 PM, Richard Quadling wrote: > Can you see what pdf tools ARE installed? > > Are the PDFs text based or just images in a PDF file (mine are both), > but for just images, you _COULD_ extract the image data manually. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert a PDF to a PNG?
On Jun 14, 2011, at 5:48 PM, Brian Dunning wrote: The PDFs are text only (white text on transparent background). I made them using the FPDF, which was tedious to set up but works great. I've since learned that I need PNG images, not PDFs. I know that I could rebuild them using GD, but it's a lot of strings of text wrapping and formatting and that would be the long, long way around. I've put in a request to see about getting ImageMagick/Ghostscript installed... see how that goes. Well there's one on me... I didn't even *know* you could covert a text PDF to a PNG image The more you know -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
I bought a 1GB external hard drive for $1000. Did I just choke on my lunch? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Ftp upload
LOL yeah. Since I can buy a 2 terabyte external hard drive and caddy for less than $300. At Best Buy. Richard L. Buskirk... -Original Message- From: Marc Guay [mailto:marc.g...@gmail.com] Sent: Tuesday, June 14, 2011 8:25 PM To: PHP General Subject: Re: [PHP] Ftp upload I bought a 1GB external hard drive for $1000. Did I just choke on my lunch? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extracting data from exec() call
On 6/14/2011 10:35 AM, Ashley M. Kirchner wrote: > > I'm trying to extract data coming from an exec() call. The exec() call is > performing an ncdump on a netCDF file: > >$filename = "mlab.20110101.cdf"; > exec("/usr/bin/ncdump -l 2048 -v wmax ".$filename, $output); > echo "---\n"; > print_r($output); > echo "---\n"; > ?> > > This is all fine, however the data comes in with extra information I don't > need, and the data I do need is in a long string format: > > Array > ( > [0] => netcdf mlab.20110101 { > [1] => dimensions: > [2] => time = UNLIMITED ; // (288 currently) > [3] => variables: > [4] => int base_time ; > [5] => int samp_secs ; > [6] => float lat ; > [7] => float lon ; > [8] => float alt ; > [9] => int station ; > [10] => float time_offset(time) ; > [11] => float tdry(time) ; > [12] => float rh(time) ; > [13] => float pres(time) ; > [14] => float cpres0(time) ; > [15] => float dp(time) ; > [16] => float wdir(time) ; > [17] => float wspd(time) ; > [18] => float wmax(time) ; > [19] => float wsdev(time) ; > [20] => float wchill(time) ; > [21] => float raina(time) ; > [22] => float raina24(time) ; > [23] => float bat(time) ; > [24] => data: > [25] => > [26] => wmax = 5, 5, 5, 5.4, 5.7, 5.1, 7.1, 6.1, 4.4, 9.5, 13.5, > 14.4, > 11.1, 9.6, 10.5, 10.6, 11.1, 10, 15.3, 17.2, 16.9, 16, 13.9, 16.7, 15.3, 18.3, > 17.2, 16.3, 15.9, 18.9, 17.7, 19.7, 19.7, 16.6, 16.4, 16, 14.6, 14.9, 14, > 16.7, > 18.3, 16.2, 18.4, 15.4, 15.3, 13.3, 14.8, 15.6, 15.1, 14.7, 13.8, 14.2, 18, > 16.7, 16.6, 15.6, 15.8, 17.6, 17.4, 20.3, 17.4, 21.3, 18.7, 16.7, 15.4, 17.5, > 17.3, 17.7, 20.4, 17.5, 16.8, 18.1, 15.9, 17.8, 17.3, 13.9, 16.2, 17.4, 19.8, > 17.5, 19, 20, 20.3, 20.4, 20.8, 21.6, 26.4, 23.1, 21.3, 19.9, 20.1, 21.1, > 22.1, > 22.5, 21.2, 20.2, 22.2, 21.6, 19.6, 21.1, 21.7, 21, 20.8, 23.7, 26.6, 21.2, > 23.8, 23.3, 23.5, 23.9, 21.4, 22.1, 23.5, 22.8, 23, 21.8, 22.2, 25.6, 21.9, > 22.8, 26.2, 24.2, 23.6, 25.5, 26.8, 25.6, 27.4, 24.5, 23.5, 22.1, 23.1, 25.5, > 22.5, 22.5, 23.8, 21.8, 22.6, 23.5, 24, 23, 22.3, 21.6, 23.6, 20.5, 21, 19.4, > 23.6, 19.2, 18, 19.2, 20.5, 19.3, 19.1, 20.4, 18, 17.8, 18.4, 19.4, 21, 18.3, > 20.4, 21.2, 22.1, 20.1, 17.3, 17.2, 17.6, 17.2, 19.9, 21, 20.6, 21.5, 23.8, > 25, > 24, 23.9, 23.5, 27.7, 21.1, 20.8, 20.1, 18.6, 21, 18.7, 19.9, 16.4, 16.3, > 17.3, > 11.8, 11.4, 15.2, 12.4, 14.2, 16.3, 21.6, 25, 19, 7.7, 9.7, 15.7, 7, 11.1, > 10.3, > 11.2, 14.8, 11.7, 5.5, 5.5, 5.5, 6.9, 7.6, 6.5, 6.4, 6.7, 6.7, 4.9, 5.1, 4.7, > 5.7, 5.5, 9.2, 6.2, 7.1, 7.7, 6.5, 5.5, 6, 6.4, 7, 6.2, 6.7, 4.7, 3.8, 9.2, > 8.1, > 7.6, 6.8, 6.3, 7.1, 10.5, 8, 9.9, 10.2, 12, 9.4, 14, 18, 11.9, 17.7, 20.9, > 18.8, > 17.4, 13.5, 13.8, 12.6, 5.5, 6.1, 6.6, 6.3, 6.3, 5.1, 7.7, 5.8, 5.4, 4.9, 4.5, > 4.9, 4.7, 5, 4.8, 4.5, 5.6, 5.9, 4.6, 5.7, 7.2, 6.1, 6.4, 5.4, 6.1, 5.6, 5.9, > 6.4, 9.5, 11.2, 15.8, 15, 13.6 ; > [27] => } > ) > > ncdump doesn't provide an option to suppress the header information, and > as > you can hopefully tell, the data I'm looking for is in one long string at key > position 26. > > How can I extract what I need from that (wmax) and have it as an array: > wmax > = array(5, 5, ...) > > This is only one variable. I will be pulling more variables out, and they > all come out the same way as above, as strings. The headers might change, so > I > can't simply say ignore the first 0-25 keys and expect what I need to be at > position 26. I need a reliable way of detecting where the data section > starts. > And I need to convert the strings into arrays for each data set. > > Suggestions? > Here is a one liner that assumes a lot print_r(explode(', ', substr($output[count($output)-2)], 7)); Now, if you want a little more error checking and forgiveness, try this Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ftp upload
Marc, I've got a bridge to sell you... On Tue, Jun 14, 2011 at 6:03 PM, wrote: > LOL yeah. > Since I can buy a 2 terabyte external hard drive and caddy for less than > $300. At Best Buy. > > Richard L. Buskirk... > > > -Original Message- > From: Marc Guay [mailto:marc.g...@gmail.com] > Sent: Tuesday, June 14, 2011 8:25 PM > To: PHP General > Subject: Re: [PHP] Ftp upload > > I bought a 1GB external hard drive for $1000. Did I just choke on my > lunch? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >