Author Topic: GD support  (Read 7137 times)

0 Members and 1 Guest are viewing this topic.

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
GD support
« on: October 24, 2003, 09:53:33 »
Any plans to add support for GD, as well as ImageMagick? It would be nice for those of us stuck on servers without ImageMagick installed, as most web hosts support GD.

As GD comes with a Perl module, I don't think it should be too hard to accomplish, although I haven't actually tried in it Perl myself - only in PHP.

My former host had ImageMagick so I haven't had any problems so far - but my current host, which I just switched to, seem very reluctant to install ImageMagick...

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #1 on: October 25, 2003, 16:40:41 »
I just discovered GD the other day. Not sure if it's capable of doing what I need or not, but I'll add it to the to do list for further investigation...

Cheers

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #2 on: October 26, 2003, 05:16:50 »
Thanks. I know that GD is fully capable of resizing of images (for creating thumbnails), anyway. Not sure if it's anything else that needs to be done for album.pl...

If it is of any help, I'd be happy to look into how to resize images using GD in Perl, and provide you with the code, as long as you can then manage to integrate it into the script.  :)

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #3 on: October 26, 2003, 09:28:32 »
Cool, any help you can provide would definitely speed things along. :)

I've found myself to be pretty busy lately, and only able to make minor changes. (Check the to do list to see how much is queued up :()

Anyway, thanks for the offer, it'd be a great contribution!

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #4 on: October 26, 2003, 19:08:16 »
Note to me: documentation is here: http://theoryx5.uwinnipeg.ca/CPAN/data/GD/GD.html

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #5 on: October 30, 2003, 15:12:37 »
Hi Daniel,

I've made some progress, but it doesn't look like it's completely working yet...

I've integrated your code (thanks) and if you re-download, the new album.pl has GD support. Sort of. You have to add "perl_gd=1" to your album.cfg (anywhere is fine, it'll be under the thumbnail section when it's added "for real".)

I've found that it hangs most of the time and produces size 0 images, but maybe you'll have better luck. I'll keep trying, but thought I'd get this out so you can tinker if you want.

(One other thing I noticed is that GD can't handle .gif files, so it may not be appropriate for everyone.)

Cheers

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #6 on: October 31, 2003, 13:42:19 »
It didn't work too good for me either. It didn't produce 0 size images for me, but unrealistically small images anyway (around 9 - 20 bytes), which obviously didn't contain any actual image data...

With GD enabled, sometimes album.pl dies with a white screen as well - if I refresh the page, it usually works. And sometimes, it seems to be extremely slow, taking 30 - 60 seconds before something actually happens.

I wonder why...  ??? This is very strange, as the exact same code worked when I used it stand-alone.

Regarding GIF support: The newer versions of the GD library has read-only support for GIF files which is possible to use from PHP, but for some strange reason the Perl module doesn't include those functions...  :(

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #7 on: October 31, 2003, 15:22:15 »
Interesting, something must be wrong with the code, so I'll take a second look when I get a chance...

Hopefully a perl GD module with GIF support comes out soon...

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #8 on: October 31, 2003, 18:52:39 »
Please do that. In order to try and isolate the problem, I have now tested using my thumbnail code in a smaller script, looping through an entire directory of images and creating thumbnails of each and every one. It worked fine, and the script created thumbnails of 20 images in much less than a second.  :)

So the problem must somehow lie into the actual integration in album.pl, and not with the GD thumbnail code itself...

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #9 on: November 01, 2003, 08:37:19 »
Cool, that's good to know. That was one of my suspicions. Thanks!

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #10 on: December 06, 2003, 07:39:13 »
Any progress yet? Have you had time to look into the problems with the GD integration yet?

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #11 on: December 09, 2003, 16:06:49 »
I haven't, but please don't take that as a sign that I won't. I may need some reminders here and there, but I do want to get this working...

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #12 on: January 21, 2004, 21:33:32 »
Any progress? Sorry for nagging, but I'm anxious to get this up and running ASAP...

Offline Mike Bobbitt

  • album.pl Author
  • Administrator
  • I Spend Too Much Time Here
  • *****
  • Posts: 3381
  • Karma: +35/-2
    • Mike's Development Archive
Re:GD support
« Reply #13 on: January 22, 2004, 16:40:07 »
You're not a nag, I'm just bloody slow...

I've taken another crack at it, and I think I got it working... GD doesn't seem to be very tolerant of mismatched sizes...

Anyway, the download zip has been updated. Bear in mind that GD works only for JPEG files...

Let me know how it goes, and thanks for your help and patience!

Cheers

Offline Daniel Hofverberg

  • album.pl Tester
  • **
  • Posts: 20
  • Karma: +0/-0
    • Family Ties Home Page
Re:GD support
« Reply #14 on: January 31, 2004, 17:50:50 »
It seems to work pretty well now - thanks. It's not perfect, album.pl skipped generation of thumbnails for a few of my pictures (less than 1%), but for the vast majority of images it works fine.

One thing though: As it is now, pictures are only generated when you visit a page, and not actually displayed then (only a generic icon is displayed), so you'll have to refresh the page in order to actually see them the first time. I e just like it was with ImageMagick in earlier versions of the script. Is that a deliberate limitation, or a mistake? Is there any way to make it so the created thumbnails are displayed right away?