[PHP] Re: replying to list (I give up)

2010-04-22 Thread O. Lavell
Michelle Konzack wrote:
 Hello David McGlone,
 
 Am 2010-04-21 08:27:18, hacktest Du folgendes herunter:
 I give up. trying to reply to messages on this list is tedious. I can't
 pinpoint whether it's because the list is set up to make replies go to
 the OP or the OP has his reply-to in his mail client set, or most
 people are hitting the reply-to button instead of simply reply.
 
 You are using Evolution and I am wondering, why you do not use the
 List-Reply Button!

There is no such button in the Evolution version I am using, but Ctrl+L 
works just as well.

I prefer to read this list as an nntp newsgroup on news.php.net.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] open source bookshop

2010-03-17 Thread O. Lavell
Tommy Pham wrote:
 Ali Reza Sajedi wrote:

 Hello all,

 Does anybody know a good open source bookshop/bookstore system written
 in php+mysql?

 Sounds like you're looking for an e-commerce solution.

You mean a webshop?

 Did you search for 'open source e-commerce' ?

It could be that a bookshop has specific requirements that a generic 
webshop application can't meet.

Sorry, Ali, I can't help you either.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Linux ERD software

2010-02-24 Thread O. Lavell
haliphax wrote:

 Dia is also a superb diagramming software, though I don't think it
 generates any SQL for you when it's said and done.

Dia can be scripted and there is some interesting looking stuff here:

http://projects.gnome.org/dia/links.html

(I never tried)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Linux ERD software

2010-02-18 Thread O. Lavell
Ashley Sheridan wrote:

 I don't normally need an ERD, but this latest project I'm on has some
 pretty complex database tables, and as I'm working with someone else on
 it, I need to plan out exactly how all the tables relate to each other
 properly. Do any of you have any suggestions for ERD software that will
 run on Linux. It can't be web-based (unless it's something I can run
 easily on my own local server) as I won't have access to the Internet
 all the time I'm working on this.

MySQL Workbench, Azzurri Clay.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Lightweight web server for Windows?

2009-11-19 Thread O. Lavell
Peter Ford wrote:
 O. Lavell wrote:
 
 Also, it is not for daily use. I have two desktop computers and a
 server for that. This is for when I have to go by train or something.
 
 Essentially it is just an extra plaything.
 
 
 Does the battery still hold enough charge for a train journey - that
 always seems to be the first thing that goes on old laptops.

Still good for about 1,5 hours at full brightness. Less, obviously, when 
I use either the PCMCIA network card or a USB Wifi stick. But I won't on 
the train. Not bad really, this was another thing I was pleasantly 
surprised with.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Lightweight web server for Windows?

2009-11-19 Thread O. Lavell
richard wrote:

 I would have recommended Omni HTTPd, but it seems it is no more. Anyone
 know what happened to it?

Funny, how it seems that there aren't so many choices for this in the 
Windows world.

 Regardless, I'd recommend buying a server
 (cheap or otherwise) running your target environment, and use that. If
 it's *nix, then you can use WinSCP to interface with it.

I already have a server in the attic that I use for most of my projects 
and experimentations. For some other stuff I do I connect to my clients' 
servers with VPN, SSH et cetera.

Now I just have an extra little computer that I can use to try out ideas 
from the sofa and to make better use my time on my weekly train trip.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: need browser auto-form predictable fill-in randomizer addon

2009-11-19 Thread O. Lavell
Daevid Vincent wrote:

 I have a form with probably 100+ elements from input, checkbox, select
 boxes, textareas, etc. It's extremely tedious to fill these in all the
 time and submit while developing/testing.

If it is tedious for you it will be tedious for your future users. And as 
a rule, they have far less patience than you have...

 Anyone know of a plugin to Firefox (or IE for that matter) that will
 fill in the fields, select stuff, check stuff, etc. with some modicum of
 predictability. Random text only goes so far when debugging as you don't
 necessarily know what the field SHOULD contain.

Long time ago that I used it, but I think what you want should certainly 
be possible with this:

http://www.autoitscript.com/autoit3/index.shtml



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Lightweight web server for Windows?

2009-11-18 Thread O. Lavell
Jonathan Tapicer wrote:

 Try nginx (http://nginx.net/), very light, has a Windows binary
 distribution and can be configured easily for PHP.

Sorry for my late reply, and thank you for this suggestion. I am now 
trying nginx and it looks very promising so far. It seems to be both a 
very simple and sufficiently capable little web server. There is only a 
little problem that it doesn't run as a service in Windows, but there may 
be solutions for that.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Lightweight web server for Windows?

2009-11-18 Thread O. Lavell
Manuel Lemos wrote:

 Hello,
 
 on 11/15/2009 07:00 PM O. Lavell said the following:

[..]

 My initial thought was to install Lighttpd under Cygwin, but perhaps I
 would be missing out on some great little server program that I have
 not yet heard about.
 
 I use lighttpd on Linux, but there seems to exist a Windows version as
 well:
 
 http://www.lighttpd.net/

I know that, yes, and I have used it once or twice on Linux. That's why I 
thought of installing it on Windows as well.

 I have written about using it with PHP here:
 
 http://www.phpclasses.org/blog/post/69-13-rules-to-optimize-your-Web-
 site-performance.html

Interesting. And thank you also for your reply. I may return to the idea 
of installing lighttpd, but for now I am giving nginx a spin.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Lightweight web server for Windows?

2009-11-18 Thread O. Lavell
Daevid Vincent wrote:

 Out of curiosity, if this is just for coding, and you're already a Linux
 guy, why not just install a lightweight linux flavor on the laptop
 instead of WF/XP?

This is a rather prehistoric (Windows 98 era) laptop, a Compaq Armada 
1700 with 266 MHz CPU. Somewhere along the way it was rescued from total 
uselessness when it received a RAM upgrade from 64 to 192 MB. It has been 
lying on a shelf in my study for years.

It does run Linux and I tried several distros. There are certainly 
lightweight window managers that I could live with too (like BlackBox). 
But running Firefox within those limited capabilities is really too much 
to ask. Firefox has obviously become a memory hungry, slow starting 
beast. Another annoyance would be the cooling fan: to keep it from 
blowing non-stop at full force I would have to compile and consequently 
maintain my own 2.6 kernel (something peculiar about this specific laptop 
that is never going to be fixed in Linux). Then someone told me to try 
Windows Fundamentals for Legacy PCs and I was pleasantly surprised. It 
is about as fast as or perhaps even faster than Windows 98 ever was and I 
am running both IE8 and Chrome. Not super fast but quite usable, must 
only remember not too open too many tabs in either browser.

I could certainly throw the old laptop away, buy a new(er) one that can 
run any software. But somehow I find it satisfying that with only a few 
adaptations I can still use an almost 10 year old computer and not miss 
out on too much modern frills. I guess I am eccentric like that.

Also, it is not for daily use. I have two desktop computers and a server 
for that. This is for when I have to go by train or something.

Essentially it is just an extra plaything.

Speaking of playing: it doesn't play Youtube videos, just chokes on them. 
Oh well. Hope your curiosity is satisfied ;)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Lightweight web server for Windows?

2009-11-15 Thread O. Lavell
What do people on this list use as an ultra-lightweight web server (with 
PHP capability of course) on Windows? I have an old but still well 
functioning laptop that I have just given a second life by installing 
Windows Fundamentals (a stripped down version of XP). This works 
surprisingly well. So now I am looking for the necessary software, so I 
can do some local programming.

Some requirements I can think of:

- Extremely small memory footprint and fast efficient code. This laptop
  still works well but it can certainly use some help!
- Both free as in beer and free as in speech would be my preference.
- Be able to run as a service in XP.
- Be able to run PHP (obviously) and perhaps a few other nice server
  features, like SSI and name based virtual hosts.

Any suggestions? I have not seriously used Windows for years now, so my 
knowledge of that platform is not exactly up to date anymore. I am used 
to dealing with Debian/Ubuntu Linux and Apache but not much else, 
frankly. Apache does seem to heavy for this. My initial thought was to 
install Lighttpd under Cygwin, but perhaps I would be missing out on some 
great little server program that I have not yet heard about.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: What method is best for generating thumbnails in PHP from PDF's?

2009-11-12 Thread O. Lavell
Chris Payne wrote:

 Hi Everyone,
 
 I have been asked to create thumbnails from the first page of a PDF
 document on the fly with PHP, I have looked online but am confused as
 there doesn't seem 1 simple solution.
 
 What would you all recommend as an easy way to do this?
 
 Any help would be really appreciated.

I think I would just call an external program to do it, like convert 
from Image Magick:

exec(convert -thumbnail 300x300 document001.pdf[0] thumbnail001.png);


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to pronounce PHP code over the phone?

2009-10-16 Thread O. Lavell
Dotan Cohen wrote:

 It's called vacation away from the 'net but there is an emergency. I'm
 certain that a fair portion of the list is familiar with that!

I haven't the slightest idea what you are talking about. Vacation? Away 
from the net? We must be from different planets...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: After browser quit

2009-08-30 Thread O. Lavell
Wouter van Eekelen wrote:

 After a little search it seems to be possible to do that within php,
 see:
 
 http://nl.php.net/manual/en/function.register-shutdown-function.php
 
 This will call a function when the browser is stopped.

No, it will certainly not.

 Exactly what I needed! :) Thanks for your repsonse.

I don't understand what it is you are trying to achieve, could you 
explain? If you really need something (anything) to happen when a user 
closes the browser then a. your script is probably ill designed and b. it 
can NOT be done with PHP. Martie is right, you will have to look into 
Javascript. But only after you have asked yourself why? and came up 
with a really good answer ;)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Best way to test for form submission?

2009-08-29 Thread O. Lavell
Shawn McKenzie wrote:
 Adam Jimerson wrote:
 This question might give away the fact that I am a php noob, but I am
 looking for the best way to test for form submission in PHP.

[..]

 Just to throw it into the mix:
 
 if(!empty($_POST)) for a general test of whether any form was posted.

There are more methods, I always use:

if($_SERVER[REQUEST_METHOD] == POST) {

do_something();

}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] clean url problem .htaccess

2009-08-01 Thread O. Lavell
A.a.k wrote:

 what if I don't have access to server to enable mod_rewrite like a
 hosting, is there anyway to work around?

No.

 just don't want to build entire website and finally can't get a hosting
 to enable mod_rewrite for me.

Then make it a requirement when you are choosing a (shared) hosting 
provider. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: redirect to a static page

2009-06-20 Thread O. Lavell
Vit wrote:

 Hi all,
 
 I'm trying to understand how to redirect to a static page
 
 here you are the code (it seem to be a stupid code, but I'm just
 debugging.
 
 ?php
 
   header( Location: http://www.google.com; );
 ?
 
 instead of being redirect to www.google,com, I get the following error:
 
 Warning: Cannot modify header information - headers already sent by
 
 what can be??? how can I solve it??

The header needs to be the very first output your script sends out. No 
other output may come before it. This is clearly discussed in the manual 
at http://www.php.net/header.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: looking for source to pull data (price of oil)

2009-06-16 Thread O. Lavell
Kurrent wrote:

 I am just simply looking for the price of nymex crude future ( see
 http://www.bloomberg.com/energy/).
 
 Any sources or other idea would be much appreciated. Thanks!

This seems to work:

?php

ini_set(user_agent, Mozilla/5.0); 
$page = strip_tags(file_get_contents(http://www.bloomberg.com/energy/;));
$search = Nymex Crude Future;
$start = strpos($page, $search) + strlen($search);
$price = floatval(substr($page, $start, 5));

echo($price);

?

It assumes a. the Bloomberg page will stay the same, b. the Nymex price 
will always be 5 characters and c. that this is for private use, because 
Bloomberg is likely going to be very unhappy about you republishing their 
data.

That said, I would personally have no qualms using this for a limited 
scope intranet application for instance.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SHOULD I NOT USE ELSE IN IF STATEMENTS....?

2009-06-08 Thread O. Lavell
adam.timberlake wrote:

 Im reading this post and i donnot understand how i should write my code:
 http://www.talkphp.com/absolute-beginners/4237-curly-
brackets.html#post23720
 
 Does it mean that i am to not write else statements in my ifs? or is it
 just saying it is something i should avoid to rite better code?
 
 please help me...

I happen to not agree completely with the post, because it seems to 
propose the use of things like continue, break and return within 
control structures (the latter as opposed to at the end of a function, 
exclusively). Very bad practice in my opinion. Think of everything that 
has ever been said of goto, it's just as bad for structured programming.

(however the use of break in switch .. case statements is an 
unfortunate necessity in PHP)

Not that I am diagramming much nowadays, but I still try to write code 
such that it could fit into a Nassi-Shneiderman diagram (NSD):

http://en.wikipedia.org/wiki/Nassi-Shneiderman_diagram

If you have never learnt to draw these then you probably should. It can 
be fun to do and they are very helpful for planning ahead and writing 
uncluttered code that can be easily debugged. And you will know you are 
nesting too deep when the diagram doesn't fit on the piece of paper you 
started on :)

To more directly answer your question I would say that if there is a 
*logical* requirement to use else after if then yes, you should use 
it and certainly not try to avoid it. There is absolutely nothing wrong 
with else.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SHOULD I NOT USE ELSE IN IF STATEMENTS....?

2009-06-08 Thread O. Lavell
Dee Ayy wrote:

 It's for better code.
 
 Personally, I'm trying to get away from multiple return/exit paths,

Hurray for you :)

[..]

 At a minimum, I would change this:
 
 function doThisAndThat($bTrueOrFalse) {
 if ($bTrueOrFalse)
 {
 return 'It is true';
 }
 
 /* If the above is true we can be sure it's NOT true here. */ return
 'It is false';
 }
 
 to this:
 
 function doThisAndThat($bTrueOrFalse) {
$return_value = 'It is false';   // Set your default state here.
 if ($bTrueOrFalse)
 {
 $return_value = 'It is true';  //  Update state.
 }
 
 return $return_value; // Only 1 exit path.
 }

Yes. This is also perfectly compatible with the diagramming method I 
mentioned previously.

 I've also noticed that, for the most part, PHP itself codes
 functions_or_variables_like_this, while coming from Java, my PHP code
 looksLikeThis.
 
 Slightly more readable for say do_www_design versus doWWWDesign versus
 do_wwwd_esign for those times when you run into such names.

It shouldn't matter much which style you use, as long as you are 
reasonably consistent in it.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Displaying images

2009-05-28 Thread O. Lavell
Miller, Terion wrote:

[..]

 header(Content-type: img/jpeg);

[..]

 This page isn't working and if I try to browse this page it wants to
 open it with an editor, it won't view in the browser.
 
 What am I doing wrong? Is it the code or the data?

Content-type: img/jpeg is undefined, the browser would not know what to 
do with it. Try image/jpeg which is the official MIME type.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: table-less layouts; Ideas welcome

2009-05-21 Thread O. Lavell
Jim Lucas wrote:

 Since this has been a topic of dicussion, I figured I would add my
 thoughts.
 
 I have been toying with the idea of doing a table-less layouts
 involving tabular data, calendars, etc...

Why?

 Recent threads have finally made me do it.  Let me know what you think.
 
 http://www.cmsws.com/examples/templates/div_tables.php
 http://www.cmsws.com/examples/templates/div_tables.phps (source for
 above) http://www.cmsws.com/examples/templates/div_cal.php

Looks clever, but unfortunately it solves a problem which does not exist. 
In other words, and with all due respect: useless.

 When you turn off the styles, the calendar becomes pretty rough on the
 eyes, but still accessible.
 
 Same thing with the tabular data structure.
 
 But, not knowing how the various types of accessibility applications
 work, I am guessing that the layout to an application trying to read it
 should work fairly well.  Let me know if I am way off the mark with my
 thoughts.

Yes. table tags are intended to represent tables. It's as if the 
authors of HTML foresaw a need... ;)

Browsers render them quite well. They are valid in all versions of HTML 
including HTML 5. Why not use them?

The evil of tables is in abusing them for layout purposes. Where entire 
pages are inside tables. Where you find tables inside table cells of 
other tables (I've seen them nested 6, 7 levels, no kidding). It goes 
against fluidity, accessability, maintainability, and everything that's 
sane and right.

Tableless design means you abstain from such table abuse, that you do 
not use tables for enforcing layouts. Not that you get rid of tables 
altogether.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Really basic PHP questions -- newbie here!

2009-05-21 Thread O. Lavell
Ellen Heitman wrote:

 Hello! I would really appreciate some answers to a few basic questions.
 I have done some research online, but it would greatly help me to get
 direct answers.
 1. If my site needs to be available to many browsers, including those
 that may not be entirely up-to-date, is PHP a safe option? I mean, I
 know that Flash is something people have to have enabled on their
 browsers, but I thought I read that PHP is available to all recent
 browsers as long as the server the site is hosted on supports PHP. Is
 this true?

No, and it's not even wrong, either ;)

PHP is a programming language. You use it to create programs (more 
commonly called scripts) that run on a web server. When a script is 
requested by a browser, the PHP interpreter on the server runs the script 
and only the result is sent back to the browser.

This is a PHP script:

?php
for(i = 0; i  5; i++)
echo pHello world!/p\n;
?

This is what it looks like to the browser:

pHello world!/p
pHello world!/p
pHello world!/p
pHello world!/p
pHello world!/p

There is no need for a browser of any generation to understand PHP, 
because it will never get to see it. Of course, as the PHP programmer you 
must make sure that your scripts' output can be handled by the intended 
clients.

 2. How can I preview my PHP while I'm coding? I'm using TextWrangler. I
 have already followed the installation tutorial here:
 http://foundationphp.com/tutorials/php_leopard.php. The test PHP file
 does work in my Safari browser. However, when I try to preview my .php
 files created in TextWrangler with Safari it doesn't work.

You need to put your PHP files in the web server's home directory, 
probably the same folder where you placed the test file from that 
article, and access them through http. That would look like

http://localhost/yourscript.php

 3. I need something that functions as an iframe. I've been reading that
 include() serves this purpose.

No. Completely different things.

 However, I've found that I have the make
 the content in the iframe the main content and call the things around
 it. I want to do the reverse. I want the other content on the main html
 page in place, and just want to call the text in the frame box. Is this
 doable?

Of course, with include() you can include the content of a file into a 
script file *before* it gets interpreted. But what it looks like in the 
resulting output and whether there is a box or a frame is entirely up to 
you.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: SQL help?

2009-05-18 Thread O. Lavell
Skip Evans wrote:

 Hey all,
 
 I have a SQL requirement I'm not quite sure how to compose.
 
 I have two tables, shows, and shows_dates. It's a one to many
 relationship where there is a single entry in shows and multiple entries
 in shows_dates that list each date and time for a play production for a
 run of entries in shows, like
 
 I need a query that will read each record in shows, but I only want the
 first record from shows_dates, the first one sorted by date, so I can
 display all shows in order of their opening date.
 
 Not sure how to grab just the first record from shows_dates though.
 
 Hint, anyone?

I guess this should work in most databases, it does in MySQL:

select q.name, min(q.date) as firstdate from
  (select s.id, s.name, d.date
from shows s, shows_dates d
where d.shows_id = s.id)
  as q
group by q.id
order by firstdate;

A left join in the sub query will also grab the shows for which no 
shows_dates row exist:

select q.name, min(q.date) as firstdate from
  (select s.id, s.name, d.date
from shows s left join shows_dates d
on d.shows_id = s.id)
  as q
group by q.id
order by firstdate


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Generating dynamic PDFs

2009-05-05 Thread O. Lavell
Kevin Kaiser wrote:

[..]

 All you have to do is sign up for an API key, upload your document
 templates and POST data to our server. We handle everything else. A
 stream of PDF data is passed back to your application and you can save
 it as a file, prompt the user to download it right then and there or
 push it into a database.

So what else do you do with the documents that get posted to your server, 
and why should anyone trust you?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP class or functions to manipulate PDF metadata?

2009-04-07 Thread O. Lavell
Peter Ford wrote:

 O. Lavell wrote:
 Peter Ford wrote:

[..]

 I do accept that the metadata should be machine-readable: that part of
 your project is reasonable and I'm fairly sure that ought to be
 possible with something simple. The best bet I found so far is PDFTK
 (http://www.pdfhacks.com/pdftk/) which is a command-line tool that you
 could presumably call with exec or whatever...
 
 Like I said, this is what I am already doing with the pdfinfo utility
 from xpdf.
 
 Sorry - I guess I didn't read that bit carefully enough...

No problem at all, I was really glad someone wanted to share their 
thoughts anyway after it first seemed that no one was interested.

[..]

 So thank you again for pushing me in that direction, even if
 unintentionally and despite the fact that what I am doing goes against
 your judgement ;)
 
 
 As I know only too well, you can't always choose your customers
 (especially if they choose you...) and you certainly can't control all
 of the sources of data you have to deal with!

Exactly.

 I have spent many hours/days/possibly longer hacking through files that
 are in one form to get data into another, and PDF is the one that always
 makes me nervous :(

So far you, Tedd and I agree on this. The so-called portable document 
format is a rather convoluted thing.

 My judgement is certainly not final, or even particularly important: if
 I had time I would also look into at least getting the metadata with
 pure PHP.
 
 Good luck...

Thank you. If I did have the time (to spare) I would feel almost obliged 
to try to figure it out. Perhaps in a week or two...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP class or functions to manipulate PDF metadata?

2009-04-06 Thread O. Lavell
Peter Ford wrote:

 O. Lavell wrote:

[..]

 Any and all suggestions are welcome. Thank you in advance.
 
 So many people ask about manipulating, editing and generally processing
 PDF files. In my experience, PDF is a write-once format - any
 manipulation should have been done in whatever source generated the PDF.
 I think of a PDF as being a piece of paper: if you want to change the
 content of a piece of paper it is usually best to chuck it away and
 start again...
 
 Even more so, this would apply to the PDF metadata: metadata is supposed
 to describe the nature of the document: it's author, creation time etc.
 That sort of data should be maintained with the document and ideally not
 changed throughout the document's lifetime (like the footer, or
 end-papers in a physical book)

Thank you very much for your reply. And it's not that I don't agree with 
you. Because I do, completely.

However...

PDFs often come from sources that can't be bothered to fill in the 
relevant fields correctly, completely, or at all. For those cases I would 
like the users of my application to be able to correct the values found 
in the metadata. Upload the PDF, get a nice little HTML form with 4 or 5 
values to review or edit. That sort of thing.

 I do accept that the metadata should be machine-readable: that part of
 your project is reasonable and I'm fairly sure that ought to be possible
 with something simple. The best bet I found so far is PDFTK
 (http://www.pdfhacks.com/pdftk/) which is a command-line tool that you
 could presumably call with exec or whatever...

Like I said, this is what I am already doing with the pdfinfo utility 
from xpdf.

But now that you mentioned pdftk... I just tried it and it does seem to 
come close to what I want. It is capable of writing a new PDF with the 
contents of an existing one, with new metadata fed as a text file. So it 
shouldn't be very hard to write a little PHP around that process.

Now I need to think a bit more about this approach. Perhaps it can be 
implemented using only pure PHP, after all. But for the time being, pdftk 
will do.

So thank you again for pushing me in that direction, even if 
unintentionally and despite the fact that what I am doing goes against 
your judgement ;)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP class or functions to manipulate PDF metadata?

2009-04-06 Thread O. Lavell
tedd wrote:

[..]

 All the attempts I have done into opening up a PDF file and then trying
 to make sense of it and put it back together with something changed have
 been absolute failures.
 
 The algorithm used to make a PDF file reminds me of a replacement-type
 compression technique -- it's not easy to understand what was done.

It's definitely voodoo. And I'm not adverse to a little voodoo myself, 
but someone else's voodoo in which you aren't initiated always seems to 
be so much more impenetrable...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP class or functions to manipulate PDF metadata?

2009-04-03 Thread O. Lavell
Hi group,

I am looking for an easy way to manipulate (read, write) the metadata 
(title, subject, keywords, author) in PDF files through PHP.

Most PHP/PDF solutions I have found so far (through Google) are aimed at 
constructing PDFs from text and graphics, with lots of fancy features, 
but most of them omit metadata functions altogether.

I would also prefer something extremely lightweight that I could just 
include_once() into my script, i.e. not a module or external program. I 
am currently using pdfinfo from xpdf-utils, but it has to go.

My use case is I want to build a database with the metadata of a bunch 
(many hundreds, perhaps thousands) of PDF files in a directory on the 
server for easy search, statistics and retrieval. I also want users to be 
able to make edits to any PDF's metadata from the web.

If it can be at all avoided, I would rather not have to invent the wheel 
myself here. I have looked at the Adobe PDF specification a bit and it 
looks quite... challenging. Or should I say daunting.

Any and all suggestions are welcome. Thank you in advance.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php