Re: [PHP] Auto unzip uploaded file
James Lobley wrote: > You might like to take a look at this: >http://www.phpconcept.net/pclzip/index.en.php > I've had great success with it - both extracting files and creating zips. Thank you, the page looks great. Norbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Broken pipe
Hi all, I wrote a php script which is running very long queries (hours) on a database. I seem to have a problem to run the code when there are single queries which take long times (like 5 hours for an update query), from the log of the database I received the following code: 2005-09-30 17:12:13 IDT postgres : LOG: 0: duration: 18730038.678 ms statement: UPDATE product_temp SET nleft=(SELECT 2005-09-30 17:12:13 IDT postgres : LOCATION: exec_simple_query, postgres.c:1035 2005-09-30 17:12:13 IDT postgres : LOG: 08006: could not send data to client: Broken pipe 2005-09-30 17:12:13 IDT postgres : LOCATION: internal_flush, pqcomm.c:1050 2005-09-30 17:12:13 IDT postgres : LOG: 08P01: unexpected EOF on client connection 2005-09-30 17:12:13 IDT postgres : LOCATION: SocketBackend, postgres.c:287 2005-09-30 17:12:13 IDT postgres : LOG: 0: disconnection: session time: 6:04:58.52 2005-09-30 17:12:13 IDT postgres : LOCATION: log_disconnections, postgres.c:3403 Now after the 5 hours update it need to echo into a log file a line which say that it ended this command (just for me to know the times), my assumption is that PHP read the code into memory at start and opened the connection to the file, after a time which he waited to any given "life sign" he gave up and closed the connection to the file, and when the code came back to the file it encountered no connection to the file (broken pipe). Am I correct at my assumption? if so how can I set the PHP to wait how much I tell him? Ofcourse if im wrong I would like to know the reason also :) Thanks in advance, Ben-Nes Yonatan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test Emai --- Please igonre
This is a test mail. Please igno re it -- Zareef Ahmed :: A PHP Developer in India ( Delhi ) Homepage :: http://www.zareef.net
Re: [PHP] PHP 5 Hosting
On 9/30/05, Tom Chubb <[EMAIL PROTECTED]> wrote: > This is an interesting one. > As someone learning PHP, I am still confused which route I should be going > down? > Especially as I am looking to take on a dedicated server soon, I don't > know if PHP5 will become standard soon or are we going to see PHP6 > first??!? It is a really serious problem, PHP 5 have so much good things specially in terms of XML that I just want to use them in my programmes but whenever I decide to do programming in PHP 5, I stuck on the choice of a good server. Most of the Hosting service providers are still providing hosting in PHP 4. I think PHP is going through a very tough phase. It has got the capabilities but we can not use them, thats why we can SAY that PHP is good programming language But we can not PROVE that in practically. Well the original posting was about hosting service provider, somewhere I read about HOSTWAY. they are in PHP 5 hosting. Zareef Aahmed Please can some more experienced people let me have their views on this? > Many thanks,# > Tom > > On 30/09/05, Joe Wollard <[EMAIL PROTECTED]> wrote: > > The first two results both seem pretty good at a glance: > > > > http://www.google.com/search?hl=en&q=php5+ssh+hosting&btnG=Google+Search > > > > > > > > On Sep 29, 2005, at 8:29 PM, Ed Lazor wrote: > > > > > Any recommendations on good host providers for PHP 5? Bonus points > > > if they support SSH access and a PHP compiler like Zend. > > > > > > Thanks, > > > > > > Ed > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Tom Chubb > [EMAIL PROTECTED] > 07915 053312 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Zareef Ahmed :: A PHP Developer in India ( Delhi ) Homepage :: http://www.zareef.net
[PHP] php5<-->com terribly wrong ?
Dear experts, something must be terribliy wrong with either php5<->com or our configuration/code. We used to control MS-Index-Server via php4 without any problems: $q = new com ("ixsso.Query"); $util = new com ("ixsso.util"); $q->query = $QueryText . ' AND #filename "(*"'; $q->SortBy = "rank[d]"; $q->catalog = "docs"; $q->Columns = "filename, Path, size, characterization, rank"; $q->MaxRecords = 300; $util->AddScopeToQuery ($q, "/", "deep"); $q->LocaleID = $util->ISOToLocaleID("EN-US"); $rs = $q->CreateRecordSet("nonsequential"); // Loop over result while (!$rs->EOF) { $rowcount++; $rs->MoveNext(); } Since we migrated to php5 we changed the iterator to run with FOREACH which causes a fatal error: foreach($rs as $ResultCounter) { ... } --> Fatal error: Uncaught exception 'Exception' with message 'Object of type variant did not create an Iterator' in.. Same thing happens with: foreach($rs as $ResultCounter => $row) { ... } --> Fatal error: Uncaught exception 'Exception' with message 'Object of type variant did not create an Iterator' in.. Also, we tried to use the com-exception try..catch which didn't work either. What's wrong here??? Environment : win XP/2003, Apache 2.0.53, php 5.0.5 I'm thankful for any hint! Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test Mail please igonre it
-- Zareef Ahmed :: A PHP Developer in India ( Delhi ) Homepage :: http://www.zareef.net
Re: [PHP] "Sanitize" paths
realpath() is your friend... That has been my first impression too, but... realpath() expands all symbolic links I am actually using symlinks :) I trust the files on my server so "local redirects" via symlinks are no problem, the user submitted data is. Then realpath() your doc root as well and then you'll be comparing apples to apples... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "Sanitize" paths
On Sun, 2005-10-02 at 11:26, Philip Hallstrom wrote: > >> realpath() is your friend... > > > > That has been my first impression too, but... > > > >> realpath() expands all symbolic links > > > > I am actually using symlinks :) > > > > I trust the files on my server so "local redirects" via symlinks are no > > problem, the user submitted data is. The following might help you write your own: http://www.interjinn.com/jinnDoc/interjinn.function.jinnfullRelativePath.phtml Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert array to HTML GET request
Newbe question: How does one convert an array into a HTML GET request easely? Are there any standard functions? Same for HTML POST requests. Thanks, Martin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert array to HTML GET request
Martin van den Berg wrote: How does one convert an array into a HTML GET request easely? Are there any standard functions? Same for HTML POST requests. HTTP GET and POST requests are formatted the same, just sent in different ways. I don't know if there's a function; I'd just use: 'oranges', 'pears' => 'peaches', ); $queryParts = array(); foreach( $myArray as $key=>$value ) { $queryParts[] = "$key=$value"; } $query = implode( '&', $queryParts ); // For GET, use e.g.: $data = file_get_contents( "http://www.example.com/?$query"; ); // For POST, pass $query to curl_setopt for an HTTP POST (see CURL docs) ?> Disclaimer: I typed this from memory and haven't tested it, so there might be minor errors, but you get the picture. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Hosting
Sheesh! No week passing by without people complaining about hosters missiong out on PHP5. This is one point where we in Germany seem to be lucky. The two biggest german hosters 1&1 (about 4 million domains) and Strato (about 2.5 million domains) both offer SSH and the possibility to chosse the PHP version on a per directory basis (via .htaccess). Strato offers PHP 3.x, 4.0.x, 4.3.x and 5.0.x in parallel. Perhaps you should think about "outsourcing" your hosting *g*. For about 13 EUR per month you get PHP3, 4, 5 and even Ruby, SSH access, MySQL access, 4 Domains, 600MB space and 30 GB free traffic. AllOLLi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert array to HTML GET request
Jasper Bryant-Greene wrote: Martin van den Berg wrote: How does one convert an array into a HTML GET request easely? Are there any standard functions? Same for HTML POST requests. HTTP GET and POST requests are formatted the same, just sent in different ways. I don't know if there's a function; I'd just use: 'oranges', 'pears' => 'peaches', ); $queryParts = array(); foreach( $myArray as $key=>$value ) { $queryParts[] = "$key=$value"; you might also want to use urlencode() in here to make sure the URL stays valid. - tul } $query = implode( '&', $queryParts ); // For GET, use e.g.: $data = file_get_contents( "http://www.example.com/?$query"; ); // For POST, pass $query to curl_setopt for an HTTP POST (see CURL docs) ?> Disclaimer: I typed this from memory and haven't tested it, so there might be minor errors, but you get the picture. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert array to HTML GET request
PHP 5 has the http_build_query function which does exactly what you want: http://www.php.net/http_build_query Chris Martin van den Berg wrote: Newbe question: How does one convert an array into a HTML GET request easely? Are there any standard functions? Same for HTML POST requests. Thanks, Martin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Hosting
Oliver Grätz wrote: >Sheesh! No week passing by without people complaining about hosters >missiong out on PHP5. This is one point where we in Germany seem to be >lucky. The two biggest german hosters 1&1 (about 4 million domains) and >Strato (about 2.5 million domains) both offer SSH and the possibility to >chosse the PHP version on a per directory basis (via .htaccess). Strato >offers PHP 3.x, 4.0.x, 4.3.x and 5.0.x in parallel. Perhaps you should >think about "outsourcing" your hosting *g*. > > I am assuming they're running PHP through CGI in this case, am I correct, or are they hosting on Windows to achieve the multiple PHP versions? If CGI, that rather affects performance of larger applications, it especially impact render time of more complex templates and forms. During my own testing we gained lots of time by just running it as a compiled Apache module instead of through CGI and in .htaccess. On our hosting servers we solved it by running a compiled PHP 5 Apache module on one server, and regular on the others. This way, if someone requests PHP 5, they can be put on the server that supports it, and if somebody wants to switch server from PHP 4 to PHP 5, it's an easy enough task. Or, of course, we have the CGI option to fall back on. Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: anyone want to teach php?
Karl, I cannot make promises, but I might have someone. If he answers me, I'll let you know. He got me started a few years ago. Excellent teacher, and author of phpMyAdmin :-P John Karl James wrote: Hello Team, I was wondering if there is anyone that would like to teach Me the language as a teacher of a class would. Like Giving assignments and stuff. I tried to learn from books and website tutorials but it doesn't Seem to do the trick for me. Would anybody be willing to do this, if so please email me Off list, and directly to my verizon.net address listed below. I would be willing to pay somebody for their services. I would like to keep it reasonable please. I am live from check To check. I understand most of the basics. I will have to refresh My self with the basics again but it shouldn't take to much time. Please let me know your thoughts if any one can help me. Karl James ("The Saint") [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.theufl.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert array to HTML GET request
if i understand well you need to get an array from html post if you use the same name for your html fields you automatically have an array in $_POST eg input type=text name=myfield value="field_1" input type=text name=myfield value="field_2" you'll get the array ar_myfield = $_POS['myfield'] you should achieve the same result using myfield[key] in the name of html hyh by ag. 2005/10/2, Martin van den Berg <[EMAIL PROTECTED]>: > Newbe question: > > How does one convert an array into a HTML GET request easely? Are > there any standard functions? > > Same for HTML POST requests. > > Thanks, > > Martin. > > -- > 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] HTML Header Location - relative URI issue
Hi HTML 1.1 specifies that Location in HTML Header should be absolute URI. Also says that some of the browsers will not work with relative URI. Can anyone show me which browsers fail to work with *relative URI* in a HTML Header Location? Regards, Jaepil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Header Location - relative URI issue
Jaepil Kim wrote: HTML 1.1 specifies that Location in HTML Header should be absolute URI. Also says that some of the browsers will not work with relative URI. Can anyone show me which browsers fail to work with *relative URI* in a HTML Header Location? I assume you mean HTTP 1.1, not HTML 1.1. IMHO the question you should be asking is why would you want to knowingly disobey the standard and send a relative URI? It's not exactly difficult to send an absolute URI in any circumstance I can think of. There is no guarantee that future user agents will continue to work with your website if you do send a relative URI, as they are usually (albeit loosely) based around the standards, which require an absolute URI [1]. [1] http://w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML Header Location - relative URI issue
Jasper Bryant-Greene wrote: Jaepil Kim wrote: HTML 1.1 specifies that Location in HTML Header should be absolute URI. Also says that some of the browsers will not work with relative URI. Can anyone show me which browsers fail to work with *relative URI* in a HTML Header Location? I assume you mean HTTP 1.1, not HTML 1.1. IMHO the question you should be asking is why would you want to knowingly disobey the standard and send a relative URI? It's not exactly difficult to send an absolute URI in any circumstance I can think of. There is no guarantee that future user agents will continue to work with your website if you do send a relative URI, as they are usually (albeit loosely) based around the standards, which require an absolute URI [1]. [1] http://w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30 Thanks for the reply. The situation is that I'm working with code that was written by someone else. And relative URIs were used all over the place. I had to decide how serious this is, that's why I had to ask a rather stupid question. Regards, Jaepil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image resizing...
Hi All I've been working on finishing a project SGML2IMAGE and I am sort of having trouble with resizing of images. I am trying to just use the GD library so when I distro the package it will not need any other things installed to be used. Now I am using... imagecreatetruecolor (); imagecreatefrom___ (); imagecopyresampled (); image___ (); But the thumbnails look blurry for any image less than 50% of the original image created by the PHP SGML parser. So my question seeing I am not very good with the GD library. Am I using the best functions to do the resize or should I be using some other image function(s) that may give better results! To give you a idea of what I am doing see the demo running on my note book http://24.218.192.217/capture.php Thanks sonia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php5<-->com terribly wrong ?
If you need this functionality then you should go back to PHP 4 the version that worked for you. I also have problems with this and winmgmts object. some classes work others don't, most times it's a VARIANT type problems. I know Wez is really busy but if you keep checking the snap shots you will see he is fixing things as they come in. A good idea is to check bugs.php.net before upgrading as it will help determine if a update is a wise decision! Sonia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_name("CCLTrolley")
Robert Cummings wrote: Is there a reason you're using a comma delimited string? I would recommend using an array instead: Cheers, Rob. Hi, Still absorbing this array stuff :). I'm getting this error. And when RNum = 1 or = 16 or = 116, it only registers '1', or whatever the first digit is. Warning: Bad arguments to implode() in /var/.../printtrolley.php on line 14 Array ( [TrolleyContents] => 1 3 4 4 5 6 ) I was expecting to see soemthing like: TrolleyContents[16] TrolleyContents[32] TrolleyContents[45] TrolleyContents[48] TrolleyContents[55] TrolleyContents[116] if I have done my homework, since last night ;), correctly? The manual example says: What is my correct seperator? And why does only one digit get registered? Thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] buffer problem having a mind of its own
hello again I was writing and rewriting my user function for my chat server trying to crush this bug but its beyond me whats going on. basically I have it so if a new user comes on, we know that if they type "new" at the prompt so it goes to the newuser function, asks for a username, accepts that alright, but when I ask for a password(echoed or not), even if i ask for anything else, just the second input of the function, it skips right threw that, prompts for it but apparently the buffer still has a \n in it so it is assuming that is the password and going right onto the 3rd signup prompt, i could stick with the default password being a random number and avoiding this whole problem, but i actually don't, the buffer is still full of whatever, and would ask the 3rd prompt but just drop right threw, I turned on implicit_flush in php.ini, just as a second measure, I call ob_implicit_flush() after reading from the socket each time, but the '\n' or whatever mysterious character, still seems to be there, also, I know too because before i started working on redoing the logon function, i would log on and i would automatically have a character sent but i didn't type anything so something is really screwy or am I just not clearing the buffers the right way? oh yes, as you may have assumed from what I wrote, or may not have, after the password or otherwise 2nd prompt, things work as expected with the other prompts, if this helps, I am using php 4.3.10 in command line interface -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_name("CCLTrolley")
>Warning: Bad arguments to implode() in /var/.../printtrolley.php on line 14 >Array ( [TrolleyContents] => 1 3 4 4 5 6 ) I restarted Mozilla and tried again. It's ok now. Thanks for your time. Array ( [TrolleyContents] => Array ( [16] => 16 [30] => 30 [47] => 47 [76] => 76 [368] => 368 [1687] => 1687 [1939] => 1939 [1761] => 1761 [1880] => 1880 [1936] => 1936 ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_name("CCLTrolley")
On Mon, 2005-10-03 at 00:16, John Taylor-Johnston wrote: > >Warning: Bad arguments to implode() in /var/.../printtrolley.php on > line 14 > >Array ( [TrolleyContents] => 1 3 4 4 5 6 ) > > I restarted Mozilla and tried again. > It's ok now. > Thanks for your time. The old session was probably still populated with the string version. > > Array > ( > [TrolleyContents] => Array > ( > [16] => 16 > [30] => 30 > [47] => 47 > [76] => 76 > [368] => 368 > [1687] => 1687 > [1939] => 1939 > [1761] => 1761 > [1880] => 1880 > [1936] => 1936 > ) > > ) This is the old version I demonstrated. You should go with the later version that sets the values to the quantity :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Hosting
Torgny Bjers schrieb: > I am assuming they're running PHP through CGI in this case, am I > correct, or are they hosting on Windows to achieve the multiple PHP > versions? If CGI, that rather affects performance of larger > applications, it especially impact render time of more complex templates > and forms. During my own testing we gained lots of time by just running > it as a compiled Apache module instead of through CGI and in .htaccess. Well, I guess you are right. One can compile multiple versions of PHP to run as Apache module in parallel by changing the sources (one has to change some symbol names) but I think Strato didn't do that since most shared hosting services run PHP as CGI anway for security reasons. Also, I think writing applications with high performance requirements somewhat contradicts deploying them on shared hosts. If you need performance: Get a dedicated server and - if you want - even compile yer own hand-optimized PHP. And: Clever development circumvents the CGI bottleneck. Developing is absolutely no problem under CGI since it's done by just a few users and here the flexibility of multiple version kicks in: You can freely choose! For the production version you simply use a good userland cache that minimizes the work done by PHP. AllOLLi Bree: "Do you know, I’ve finally convinced Rex to buy his first orchid." George: "Make sure you study up. I hate people who own precious flowers and don’t know how to take proper care of them." Rex: "You know what I hate? Weeds. They just pop up out of nowhere and you have to work so hard to get rid of them." George: "I find that with the right chemicals you can get rid of anything." [DH 120, earns the price for most subtext per sentence.] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_name("CCLTrolley")
>This is the old version I demonstrated. You should go with the later >version that sets the values to the quantity :) I thought I had? Haven't I? But this is the easiest shopping cart I have ever seen. However, I still have not understood what you were doing with these lines I commented out. if( isset( $_SESSION['TrolleyContents'][$_POST['RNum']] ) ) { #$_SESSION['TrolleyContents'][$_POST['RNum']] -= 1; #if( $_SESSION['TrolleyContents'][$_POST['RNum']] <= 0 ) #{ unset( $_SESSION['TrolleyContents'][$_POST['RNum']] ); #} They did not work, or seem to? John ---snip http://testesp.flsh.usherbrooke.ca/db/trolley.php Array ( [TrolleyContents] => Array ( [2378] => 2378 [2504] => 2504 ) ) ) ---snip "; if("add" == $_POST['ShopAction']) { echo "adding ..."; // Add new entry: if( isset( $_POST['RNum'] ) ) { $_SESSION['TrolleyContents'][$_POST['RNum']] = $_POST['RNum']; } echo implode( ',', $_SESSION['TrolleyContents'] ); #echo $_POST['RNum']."!!"; }else{ echo "deleting ..."; //Delete an entry: if( isset( $_SESSION['TrolleyContents'][$_POST['RNum']] ) ) { #$_SESSION['TrolleyContents'][$_POST['RNum']] -= 1; #if( $_SESSION['TrolleyContents'][$_POST['RNum']] <= 0 ) #{ unset( $_SESSION['TrolleyContents'][$_POST['RNum']] ); #} } } print_r( $_SESSION ); ?> Delete form: snip --- alt="Delete" title="Delete" style="padding-right: 5px;">Delete Add form: snip --- alt="Add to cart" title="Add to cart" style="padding-right: 5px;">Add to cart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_name("CCLTrolley")
This is what you recommended. Is there a reason you're using a comma delimited string? I would recommend using an array instead: This is what I implemented? Where did I go wrong? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDF Thumbnails
How do I implement using your script? Do this take all of the files in a directory and convert them into pdf thumbnails? Where does the directory path go? Thanks for posting and the help. On 9/29/05, Matt Darby <[EMAIL PROTECTED]> wrote: > > I wrote a script for this; it's designed to run from the command line in > *nix, but can be triggered via exec(): > > Usage: ./pdf2thumb.php "source_dir" "out_dir" > > [code] > > #!/usr/local/bin/php > > function getDirFiles($dirPath){ > $filesArr=array(""); > if ($handle = opendir($dirPath)){ > while (false !== ($file = readdir($handle))) > if ($file != "." && $file != ".."){$filesArr[] = trim($file);} > closedir($handle);} > return $filesArr; > } > > function usage(){ > echo("USAGE: pdf2thumb source_folder_path > \n\n"); > exit; > } > > if(!isset($argv[1])){usage();} > substr($argv[1],-1)=="/"?$path=$argv[1]:$path=$argv[1]."/"; > > isset($argv[2])?$dest_path=$argv[2]:$dest_path=$path; > substr($dest_path,-1)=="/"?$dest_path=$dest_path:$dest_path.="/"; > > $total_time=0; > $total_files=0; > > if(!file_exists($dest_path)){`mkdir $dest_path`;} > > $files=getDirFiles($path); > > for($i=0;$i if(substr($files[$i],-3)=="pdf"){ > echo("Converting ".$files[$i]."... "); > $time_start = microtime(true); > > $old_name=$path.$files[$i]; > $new_name=$dest_path.str_replace(".pdf",".jpg",$files[$i]); > > `/usr/bin/convert '$old_name' -thumbnail 240x160 '$new_name'`; > > $time_end = microtime(true); > $convert_time=round($time_end-$time_start,2); > echo("Done. ($convert_time seconds)\n"); > $total_time+=$convert_time; > $total_files++; > } > } > > echo("\n---\n"); > echo("$total_files files converted in ".round($total_time/60,2)." > $minutes (AVG: ".round($total_time/$total_files,2)."s)\n\n"); > > ?> > > [/code] > > [EMAIL PROTECTED] wrote: > > >You would haven't happen to have an example? I am new to imagemagick. Any > >help would be greatly appreciated. > > > >On 9/26/05, Jim Moseby <[EMAIL PROTECTED]> wrote: > > > > > >>>-Original Message- > >>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > >>>Sent: Monday, September 26, 2005 1:43 AM > >>>To: php-general@lists.php.net > >>>Subject: [PHP] PDF Thumbnails > >>> > >>> > >>>I give my users an option to upload pdf files to my site and > >>>would like them > >>>to see a thumbnail view of the file once uploaded. Has anyone > >>>heard of a way > >>>how to do this? > >>> > >>> > >>The 'convert' function of ImageMagick will do it. > >> > >>JM > >> > >> > >> > > > > > > > > >