Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

mamash
Member
From: Prague
Registered: 2004-02-21
Posts: 128
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

#25 2004-06-10 05:18:18

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

Re: mdp_Automatic Thumbnail's

Well, its been my experience that with gd versions older than 2, quality is a bit poor regardless of its settings, due to it not creating a true color image and also it doesn’t actually resample it as well. The quality of version 2 gd functions produce just as good results as Netbmp and IM that i’m aware of.

It would be nice to be able to use droplets you create from photoshop in php :D.

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

Offline

#26 2004-06-10 10:04:29

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

Re: mdp_Automatic Thumbnail's

Greenrift, just a note. I was unaware that gps was used on g1.19 , in the image_delete() function, you might want to change $id = ps back to the original $id = gps .

Cheers

Edit: You have two minor bugs, you forgot to pass the quality paramater to the imagejpeg functions on both the thumbnail and original. Lines 405, and 403.

Last edited by Caged (2004-06-10 10:29:58)


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

Offline

#27 2004-06-10 18:50:46

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

Re: mdp_Automatic Thumbnail's

automatic thumbnails v0.3

Added ImageMagick support, now you don’t have to put up with ugly thumbnail’s! Also some of the fixes Caged pointed out (thank you).

Offline

#28 2004-06-11 18:23:44

trailgirl
Member
Registered: 2004-06-04
Posts: 68
Website

Re: mdp_Automatic Thumbnail's

Does anyone know how i can install this on a Mac? I copied and pasted the text and got a blank page when I select “image” in textpattern. I selected the text and decoded the tabs and now I get a page that starts with:

<code>?php /* This is Textpattern Copyright 2004 by Dean Allen www.textpattern.com All rights reserved Use of this software indicates acceptance of the Textpattern license agreement */ check_privs(1,2,3,4,6); $extensions = array(0,’.gif’,’.jpg’,’.jpeg’,’.png’,’.swf’); if(!$step or !function_exists($step)){ image_list(); } else $step(); // ——————————————————————————————- function image_list($message=’‘) { global $txpcfg,$extensions,$path_from_root,$img_dir; $pfr = $path_from_root; extract($txpcfg); </code> rather than the image uploading page.

I think the problem has something to do with copying from Safari.

I also tried converting to Unix line endings and tried Windows-toMac Encoding.

Does anyone have a suggestion?

Offline

#29 2004-06-12 00:27:38

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

Re: mdp_Automatic Thumbnail's

aaaaah…
The server is upgraded, and the image quality is now amazing :)

Thank you for making this.


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

Offline

#30 2004-06-12 02:06:52

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

Re: mdp_Automatic Thumbnail's

> trailgirl wrote:

> Does anyone know how i can install this on a Mac? I copied and pasted the text and got a blank page when I select “image” in textpattern. I selected the text and decoded the tabs and now I get a page that starts with:

> Does anyone have a suggestion?

The file is just a UNIX encoded ANSI text file. There isn’t anything really platform specific, just plain old text. My recommendation woudl be to “Save Link As” and then rename it from there. Although copying and pasting into a text editor then saving as appropriately should work as well.

Offline

Board footer

Powered by FluxBB