Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-06-09 05:42:10

Caged
Archived Plugin Author
From: Memphis, TN
Registered: 2004-06-07
Posts: 27
Website

Re: mdp_Automatic Thumbnail's

I hope greenrift doesn’t mind, but I updated his hack to check to work with both gd versions. GD 1 doesn’t have imagecreatetruecolor nor imagecopyresampled, I just added a function to check which version the user has installed, and it works around that. Backup your current file, and try this one nimnix to see if it works, If it does, please let me know :) .

Thumbnial with GD Check


Isolated-Designs http://www.isolated-designs.net/core

Offline

#14 2004-06-09 06:11:22

nimnix
Archived Plugin Author
Registered: 2004-05-26
Posts: 63
Website

Re: mdp_Automatic Thumbnail's

My server has more issues than that since my server is running PHP 4.2.2 (had to add in file_get_contents support for the amazon plugin).

The modified script uploads the image, but when it tries to do resizing, I get the following:

Warning: imagejpeg(): supplied argument is not a valid Image resource in …/txp_image.php on line 478

Warning: imagedestroy(): supplied argument is not a valid Image resource in …/txp_image.php on line 480

Warning: imagejpeg(): supplied argument is not a valid Image resource in …/txp_image.php on line 448

Warning: chmod failed: No such file or directory in …/txp_image.php on line 449

Warning: imagedestroy(): supplied argument is not a valid Image resource in …/txp_image.php on line 450

Last edited by nimnix (2004-06-09 18:33:28)


textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki

Offline

#15 2004-06-09 06:49:15

Caged
Archived Plugin Author
From: Memphis, TN
Registered: 2004-06-07
Posts: 27
Website

Re: mdp_Automatic Thumbnail's

If this doesn’t work for you, then your gd is older than v 1.8, not sure what else you can do other than see if your host will upgrade, or pack up and move to one that has a newer version of GD installed.
<?php
//Set $photo to an image file on your server
$photo = ‘’;
header(‘Content-Type: image/jpeg’);
imagejpeg($photo);
?>

Last edited by Caged (2004-06-09 06:49:39)


Isolated-Designs http://www.isolated-designs.net/core

Offline

#16 2004-06-09 08:50:05

mamash
Member
From: Prague
Registered: 2004-02-21
Posts: 127
Website

Re: mdp_Automatic Thumbnail's

Caged wrote:

Edit: Small Bug, in the image_delete() function you’ve missed a ‘g’ that was causing the script not to be able to delete an image.

Since 1.19, ps is used instead of gps. At least in the native image functions.


Who’s gonna textdrive you home tonight?

Offline

#17 2004-06-09 10:20:28

Caged
Archived Plugin Author
From: Memphis, TN
Registered: 2004-06-07
Posts: 27
Website

Re: mdp_Automatic Thumbnail's

That would be the problem then, I have v 1.18. Thanks mamash.


Isolated-Designs http://www.isolated-designs.net/core

Offline

#18 2004-06-09 15:36:41

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: mdp_Automatic Thumbnail's

> Caged wrote:

> I hope greenrift doesn’t mind, but I updated his hack to check to work with both gd versions. GD 1 doesn’t have imagecreatetruecolor nor imagecopyresampled, I just added a function to check which version the user has installed, and it works around that. Backup your current file, and try this one nimnix to see if it works, If it does, please let me know :) .

> Thumbnial with GD Check

That’s awesome. I updated some other stuff last night but haven’t finished yet, so I’ll add these change’s. Thanks.

I’ve uploaded a new version, 0.2. Automatic Thumbnail’s

I added the ability to have square thumbnail’s (or a user set width and height) and also added Caged’s GD check function. Again, it should only be used with g1.19.

Last edited by greenrift (2004-06-09 16:04:16)

Offline

#19 2004-06-09 17:26:43

nimnix
Archived Plugin Author
Registered: 2004-05-26
Posts: 63
Website

Re: mdp_Automatic Thumbnail's

Caged, that snippet of code is giving me the error
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/bloodygoodproductions/htdocs/dev/textpattern/publish.php(796) : eval()’d code on line 153

I had checked the GD version with phpinfo() when I got those first errors, and it says GD Version 1.6.2 or higher, so when I asked my host to upgrade GD to the latest, he said version 2.0.15 was installed.

I’m waiting for feedback from my host about what’s going on.

When I changed the old version of the Automatic Thumbnail code, I just replaced the imagecopyresampled with imagecopyresized and imagecreatetruecolor with imagecreate, and they worked.

Thanks for your help guys, but it looks like my server has deeper problems than can be fixed with code.

old-school resizing – my gallery

using the original Automatic Thumbnails code with imagecopyresized and imagecreate.

resizing is kinda ugly with these GD functions…

Last edited by nimnix (2004-06-09 18:35:22)


textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki

Offline

#20 2004-06-09 22:14:26

nimnix
Archived Plugin Author
Registered: 2004-05-26
Posts: 63
Website

Re: mdp_Automatic Thumbnail's

My host will be upgrading my server, so hopefully by tonight I can get the other version of this script working on my site.

Great script! :)


textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki

Offline

#21 2004-06-09 23:24:42

Caged
Archived Plugin Author
From: Memphis, TN
Registered: 2004-06-07
Posts: 27
Website

Re: mdp_Automatic Thumbnail's

Nice nimnix, glad to see your getting some where. If your reffering to thumbnail quality being a little sketchy, you can look in the code where you see the functions greenrift created and change the quality paramater to about 90 and it will clear them up a good bit.

function image_makeJPGThumbnail($id, $ext, $new_width, $quality=90)


Isolated-Designs http://www.isolated-designs.net/core

Offline

#22 2004-06-09 23:45:19

nimnix
Archived Plugin Author
Registered: 2004-05-26
Posts: 63
Website

Re: mdp_Automatic Thumbnail's

I set the quality to 100, but some images scale down better than others. Since this is still a dev site, I can live with it for now. If I need great quality, I’ll go for photoshop first. That’ll depend on my client.


textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki

Offline

#23 2004-06-10 02:11:05

greenrift
Archived Plugin Author
Registered: 2004-03-08
Posts: 186
Website

Re: mdp_Automatic Thumbnail's

> resizing is kinda ugly with these GD functions…

Yah, GD is known for this and it really shows sometime’s. Increaseing the quality will help, but some images will just look like crap.

I am going to try to make a hack that uses NetPBM or ImageMagick to do all the resizing and recompressing, but that might not come for a while. It’s a shame that the really nice included PHP functions for images produce such horrible results sometimes.

Offline

#24 2004-06-10 02:28:19

nimnix
Archived Plugin Author
Registered: 2004-05-26
Posts: 63
Website

Re: mdp_Automatic Thumbnail's

too bad we can’t embed photoshop functions in our scripts LOL


textpattern.org :: find and share Textpattern resources
textpattern.net :: TextBook – Textpattern wiki

Offline

Board footer

Powered by FluxBB