[Contribution] oscThumb
#1
Posted 24 October 2007 - 09:08 AM
oscThumb is a contribution that uses the open source project phpThumb v1.7.7 to create thumbnails of your images.
Instead of sending the full size image to the browser and let the browser resize it, which can seriously slow down the loading time of your pages and look ugly, oscThumb will generate thumbnails and save them in a cache folder on your server, for future use.
It uses Imagemagic (if available) or GD library to generate gif, jpg or png thumbnails.
In my knowledge, this is the only thumbnailing contribution that can really protect your images agains thieves!
Following features are included:
Server caching: thumbnails created are saved on the server, no need to re-generate them for each visitor. Automatic cache cleaning function included (size, age, nbr of files).
Watermarking: place a text or image watermark on your images to protect them from thieves.
Security against URL manipulations: filenames encryption make it impossible to find the original image and URL hash check make it impossible to manipulate URL to display images in original size.
Display options: add a frame around your images or buttonize them. New size for product image on product_info.php page, selectable from admin.
Easy installation: few files to copy, 3 files to modify. Done.
I give you soon the link to the contribution, when it's out of the sandbox.
I'm using this contribution with success on few sites already.
Have fun,
Chris
New thumbnailer using phpThumb: oscThumb. Works great.
#2
Posted 24 October 2007 - 04:08 PM
Comments and questions are welcome.
New thumbnailer using phpThumb: oscThumb. Works great.
#3
Posted 25 October 2007 - 03:39 AM
I just noticed this post when looking for answers to my problems.
Anyways... here's my issues.
1. with the image watermark turned on the image comes up as normal. No watermark.
2. with the text watermark turned on I get an image just a green block with error: Invalid Hash
3. with the frame turned on the frame works
Also when I delete a product now I get this error:
1146 - Table 'comotors_p_os1.TABLE_ADDITIONAL_IMAGES' doesn't exist
delete from TABLE_ADDITIONAL_IMAGES where products_id = '69'
[TEP STOP]
Any help would be greatly appreciated.
Dave
Edited by jeebus, 25 October 2007 - 03:41 AM.
#4
Posted 26 October 2007 - 12:04 AM
#5
Posted 26 October 2007 - 06:13 AM
New thumbnailer using phpThumb: oscThumb. Works great.
#6
Posted 26 October 2007 - 09:30 AM
rigadin2, on Oct 26 2007, 07:13 AM, said:
Hey man,
I see a lot of calls to constants in your class: CFG_MASTER_SWITCH, LAST_HASH, etc.
But I don't see them ever getting set. I'm getting problems with this since no single piece of configuration is being recognized.
I think this is what needs fixing.
#7
Posted 26 October 2007 - 12:14 PM
rigadin2, on Oct 26 2007, 03:13 AM, said:
I figured that error wasn't completely part of this.. but I know I did not have this error before I made the changes to my files, so I was hoping you could tell me what I may have messed up and where?
As for the rest of the contribution... other then my issues above it works great. I love it, however I would like to have those features working as it's part of the reason I installed it.
Thanks.
#8
Posted 26 October 2007 - 01:43 PM
The constants you mentionned in the oscthumb class are the configuration parameters you see in admin. You won't see any define(.....) because all these parameters are automatically created in application_top.php .
I found a mistake in the installation sql file of this contribution, maybe it's the reason of your problems. Go to Admin > Configuration > Thumbnails, then change "Image Watermark Position" and "Text Watermark Position" to what you want. The default ("Top") value is not recognized, must be "T" once saved.
I have discovered few little bugs in my code as well as a new phpThumb version, so I'll release shortly a new version of this contribution.
Few bugs: cache cleaning not working correctly when using sub-directories (default) + black background on watermarked gif's + not working when using the includes/local/configure.php file.
I have fast tested this new phpThumb and seems to solve the watermarked gif's problem. I tried graphic + text watermark on same gif image: no problem. This new version has some new watermarking features (like graphic watermark scaling), but I'll not implement them right now in this contribution.
Also, I think that some features are useless (like watermarking heading images and small images), please comment. If nobody needs, I'll remove them.
New thumbnailer using phpThumb: oscThumb. Works great.
#9
Posted 26 October 2007 - 01:59 PM
-No matter what position I put the text watermark on it still gives the black(green) image with error: Invalid Hash
As for the need for the smaller watermarks.. I do not see a need for them.
#10
Posted 27 October 2007 - 07:34 AM
- Chris
New thumbnailer using phpThumb: oscThumb. Works great.
#11
Posted 27 October 2007 - 01:53 PM
#12
Posted 27 October 2007 - 02:06 PM
rigadin2, on Oct 27 2007, 04:34 AM, said:
- Chris
Alright with these changes made:
-text watermark works
-image watermark does not work
Here's a link to one of the images.. I think this is what you were looking for.
http://comotorsports.net/osCommerce/catalo...;h=400&fltr[]=wmt|CO Motorsports|20|C|000000|thalea.ttf|20|0|10&f=jpg&q=95&hash=f51e4f6ebda43167c558342ffc8bc5ad
#13
Posted 28 October 2007 - 08:50 AM
New thumbnailer using phpThumb: oscThumb. Works great.
#14
Posted 28 October 2007 - 07:12 PM
if ($image_watermark) {
$params .= "&fltr[]=wmi|watermarks/".WATERMARK_IMAGE."|".WATERMARK_IMAGE_POSITION."|".WATERMARK_IMAGE_OPACITY."|".WATERMARK_IMAGE_MARGIN;
}
For default directory it should be:
if ($image_watermark) {
$params .= "&fltr[]=wmi|phpThumb/watermarks/".WATERMARK_IMAGE."|".WATERMARK_IMAGE_POSITION."|".WATERMARK_IMAGE_OPACITY."|".WATERMARK_IMAGE_MARGIN;
}
For the next version a watermark directory definition (adjustable from the admin or defined in the config.php) would better.
#15
Posted 28 October 2007 - 08:17 PM
Line 126 of includes/classes/oscthumb.php
if ($width > $image_size[0] || $height > $image_size[1]) {
should be:
if ($width > $image_size[0] && $height > $image_size[1]) {
Explaination:
If an image is smaller then the requested width but larger then the requested image height then it does need to be resized and limited to the
requested limits (note the height and width are maximum width and height). As it is now then it doesn't resize it.
Example:
Image height: 600 pixels
Image width: 100 pixels
Requested height: 120 pixels
Requested width: 120 pixels
Now it need to be resized to:
height: 120 pixels
width: 20 pixels
At the moment it doesn't resized it and shows the 600 x 100 pixel image.
#16
Posted 28 October 2007 - 09:26 PM
I installed it and I got this error
Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.
can anyone help me with this please
thanks
#17
Posted 29 October 2007 - 10:56 AM
New thumbnailer using phpThumb: oscThumb. Works great.
#18
Posted 29 October 2007 - 11:19 AM
Image watermark:
The watermark directory you see in the image URL is relative to the phpThumb directory, because phpThumb is executed there. Have you experienced problem with this? Maybe that's why Jeebus does not see his image watermarks, but then it means it depends on server configuration.
The directory can be moved to a parameter, why not.
Image size:
Quote
Line 126 of includes/classes/oscthumb.php
if ($width > $image_size[0] || $height > $image_size[1]) {
should be:
if ($width > $image_size[0] && $height > $image_size[1]) {
Explaination:
If an image is smaller then the requested width but larger then the requested image height then it does need to be resized and limited to the
requested limits (note the height and width are maximum width and height). As it is now then it doesn't resize it.
Example:
Image height: 600 pixels
Image width: 100 pixels
Requested height: 120 pixels
Requested width: 120 pixels
Now it need to be resized to:
height: 120 pixels
width: 20 pixels
At the moment it doesn't resized it and shows the 600 x 100 pixel image.
New thumbnailer using phpThumb: oscThumb. Works great.
#19
Posted 29 October 2007 - 12:10 PM
#20
Posted 29 October 2007 - 01:08 PM
Quote
Line 126 of includes/classes/oscthumb.php
if ($width > $image_size[0] || $height > $image_size[1]) {
should be:
if ($width > $image_size[0] && $height > $image_size[1]) {
Explaination:
If an image is smaller then the requested width but larger then the requested image height then it does need to be resized and limited to the
requested limits (note the height and width are maximum width and height). As it is now then it doesn't resize it.
Example:
Image height: 600 pixels
Image width: 100 pixels
Requested height: 120 pixels
Requested width: 120 pixels
Now it need to be resized to:
height: 120 pixels
width: 20 pixels
At the moment it doesn't resized it and shows the 600 x 100 pixel image.
The code mentionned is for images smaller than asked: do we show them bigger or in their original size. The function asked by Frank is in case the image is bigger than asked, that's another story not covered by the class so far, but it would make sense to implement it.
New thumbnailer using phpThumb: oscThumb. Works great.









