Request for assistance (7)

1 Name: !WAHa.06x36 2004-11-21 20:58 ID:JPr5cgFw [Del]

So I had this idea:

Since it seems many PHP installs have the GD library included by default, making thumbnailing easier (and uglier, I guess), I figured it would be nice if Wakaba could use this too so as not to be at a disadvantage to Futallaby when it comes to getting thumbnailing working properly.

So I figure it would be fairly simple to make a PHP script that takes as its arguments a local filename for an image, a local filename where to place the thumbnail, and the dimensions for the thumbnail. The wakaba make_thumbnail function could then in addition to all the other things it tries also try hitting this PHP script, through the web server if need be (command-line PHP isn't all that common, is it?).

However, I'm no PHP hacker, and I'm busy coding other things (just optimized the kareha templating functions enough that I could put them in wakaba), and thus I am asking if anyone feels they would be up to the task of writing this hack.

2 Name: Albright!LC/IWhc3yc 2004-11-21 22:07 ID:ZZw3S7cw [Del]

You'll have it by the end of the day.

3 Name: Albright!LC/IWhc3yc 2004-11-21 22:17 ID:ZZw3S7cw [Del]

Just to clarify... You want it to be a command-line script, right? Something that would work like...
./phpresizer -w300 -h300 path/to/original.jpeg path/to/thumbnail.jpeg

You're right, command-line PHP scripts are quite uncommon, but possible. What ideas do you have for sending errors (original file not found, can't write to thumbnail directory, etc) back to Wakaba?

4 Name: !WAHa.06x36 2004-11-21 23:05 ID:JPr5cgFw [Del]

Well, the best would be for it to be able to work through the web server too, in case command-line PHP isn't available. And it doesn't really need to send any errors back, it's enough if the thumbnail file doesn't appear if it fails.

5 Name: Albright!LC/IWhc3yc 2004-11-22 00:37 ID:ZZw3S7cw [Del]

Okay, well, if it works through the web server, then you'll be redirecting the client's web browser from wakaba.pl to resizer.php?path=/path/to/img.jpg, right? Is that what you had in mind? Then what should the PHP script redirect the client to when it's done?

Doing it solely via the CLI will be a lot less messy, and faster as well...

6 Name: Albright!LC/IWhc3yc 2004-11-22 01:03 ID:ZZw3S7cw [Del]

http://www.anre.org/crap/tn.text works just dandily via the CLI.

If you still wanna try calling it through the web server, I can modify it to work that way too, but as I said, there's logistics we're gonna have to work out...

You'll notice the code, as it is now, outputs error messages prefixed with a two-digit number if something goes wrong (and also if something goes right). If you'd like, you can have your code read those two digits to tell what the problem was. For example, if it sees "13" as the first two digits, it can tell that the PHP script couldn't find the original file. "00" or "01" means all went well. Hope this helps.

7 Name: !WAHa.06x36 2004-11-22 01:28 ID:JPr5cgFw [Del]

I'll have a look at it as soon as I am done with some other stuff.

Anyway, I was thinking the Perl script could just open a connection to post 80 on localhost to trigger the script through the web server. It could then give the paramaters in the query string in the usual way.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: