Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] oscThumb


Guest

Recommended Posts

Hello all,

 

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

Link to comment
Share on other sites

  • Replies 443
  • Created
  • Last Reply

Top Posters In This Topic

I can't believe I stumbled across this and installed thinking it's been out forever. :D

 

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
Link to comment
Share on other sites

This is a quite young contribution, I guess you are the first one to try it after me. I'm going to check again the watermark options. For the sql error, it's not related to this contribution, 100% sure.

Link to comment
Share on other sites

This is a quite young contribution, I guess you are the first one to try it after me. I'm going to check again the watermark options. For the sql error, it's not related to this contribution, 100% sure.

 

 

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. :thumbsup:

Link to comment
Share on other sites

This is a quite young contribution, I guess you are the first one to try it after me. I'm going to check again the watermark options. For the sql error, it's not related to this contribution, 100% sure.

 

 

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.

Link to comment
Share on other sites

For the sql error, you have to define your TABLE_ADDITIONAL_IMAGES constant into admin/includes/databases.php, like: define ('TABLE_ADDITIONAL_IMAGES', 'additional_images'), value depending of the real name of the table.

 

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.

Link to comment
Share on other sites

-No matter what position I put the image watermark it still does not work. Just shows the original image

-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.

Link to comment
Share on other sites

Switch off the filename encryption (in admin, parameter "Encrypt Image Filenames" to False), and switch off the check of the hash in catalog/phpThumb/phpThumb.config.php (parameter "$PHPTHUMB_CONFIG['high_security_enabled']", so hash should not be a problem anymore. But I guess another problem will show up. Please post here the URL of your images, like it happears in the html code, it helps debugging.

 

- Chris

Link to comment
Share on other sites

Switch off the filename encryption (in admin, parameter "Encrypt Image Filenames" to False), and switch off the check of the hash in catalog/phpThumb/phpThumb.config.php (parameter "$PHPTHUMB_CONFIG['high_security_enabled']", so hash should not be a problem anymore. But I guess another problem will show up. Please post here the URL of your images, like it happears in the html code, it helps debugging.

 

- 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

Link to comment
Share on other sites

Your link is broken due to this forum but I copy-paste and get your image. The link is for a text watermark and it works. I changed to image watermark and it does not work. I then took your image to my test shop and the image watermark is showing up. Have you tried to choose another watermark image from the admin? Which version of the GD library you have?

Link to comment
Share on other sites

Line 232 of includes/classes/oscthumb.php is setting the wrong directory link:

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.

Link to comment
Share on other sites

Another problem, in resizing images who are smaller then the requested image size.

 

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.

Link to comment
Share on other sites

im very new to oscommerce...

 

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

Link to comment
Share on other sites

What version of osCommerce are you using? Have you just copied the contribution files over your installation? The files delivered with this contributions are for 2.2MS2 version, if you just copy over a 2.2RC1 you'll get this error. It is mentionned in the install instructions to do the changes manually and not overwrite if you have a 2.2RC1, which is at this date the latest version. The best would be to use a file-compare program to merge the changes (believe me, it'll save you millions of hours).

Link to comment
Share on other sites

@Frank:

 

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:

Another problem, in resizing images who are smaller then the requested image size.

 

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.

Well done, you are right there is something wrong here. Next version coming soon... with newer version of phpThumb, just need time to pack everything together again.

Link to comment
Share on other sites

About the code for the size (line 126 in oscthumb class v1.0.0):

Another problem, in resizing images who are smaller then the requested image size.

 

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.

Link to comment
Share on other sites

For the sql error, you have to define your TABLE_ADDITIONAL_IMAGES constant into admin/includes/databases.php, like: define ('TABLE_ADDITIONAL_IMAGES', 'additional_images'), value depending of the real name of the table.

 

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 .

 

 

To be honest I'm content now that I have the text watermark working. I have no need for the image watermark. However to my error above...

 

1146 - Table 'comotors_p_os1.TABLE_ADDITIONAL_IMAGES' doesn't exist

 

delete from TABLE_ADDITIONAL_IMAGES where products_id = '69'

 

[TEP STOP]

 

 

I know you tried to help with the answer but I'm still not sure what I need to do here. I'd like to fix this issue as everytime I try deleting a product I get that error. It's just a bit unsettling when working on the site.

 

Is there code from a specific file that I could post up that would help? I know this error came when I was modifing the existing files with the code changes. I just don't know what I messed up.

 

Thanks.

Edited by jeebus
Link to comment
Share on other sites

Hy, this contrib look very promissing to me.

I started implementing right away, but I got another problem:

I did the install manual, but from the moment I make the addition in catalog/includes/functions/html_output.php The website shows no output whatsoever.

 

Where did I go wrong?

 

Jeroen

Link to comment
Share on other sites

By "No output" do you mean no images or a blank page? Certainly something went wrong when modifying html_output.php . There is one function to rename, and a new one to copy in from the contribution. Best use a file compare program like Beyond Compare or WinMerge.

 

- Chris

Link to comment
Share on other sites

To be honest I'm content now that I have the text watermark working. I have no need for the image watermark. However to my error above...

 

1146 - Table 'comotors_p_os1.TABLE_ADDITIONAL_IMAGES' doesn't exist

 

delete from TABLE_ADDITIONAL_IMAGES where products_id = '69'

 

[TEP STOP]

I know you tried to help with the answer but I'm still not sure what I need to do here. I'd like to fix this issue as everytime I try deleting a product I get that error. It's just a bit unsettling when working on the site.

 

Is there code from a specific file that I could post up that would help? I know this error came when I was modifing the existing files with the code changes. I just don't know what I messed up.

 

Thanks.

 

Are you using some kind of multi-product-image contribution? If not, check in admin/categories.php where the word TABLE_ADDITIONAL_IMAGES is used and remove it.

Link to comment
Share on other sites

Hy i followed all the steps in the instalation although i come up with some errors . I am using CakePhp , although my instalation is at cakePhp webroot and works fine when i disable the contribution, my problem comes with the paths i will show the diferents errors i get as i change the configuration

$PHPTHUMB_CONFIG['document_root'] = '/catalog';

with the path defined as above i get this errors

falloconbarracatalogennovedades.jpg

falloconbarracatalog.jpg

 

$PHPTHUMB_CONFIG['document_root'] = DIR_FS_CATALOG;

with the path defined as above i get this errors

falloconrootdeoscmmerce1.jpg

falloconrootdeoscmmerce2.jpg

 

 

I have also try this settings but i still get the more or less same mistakes with a mismached path , i have 2.2 version.

the working url Now is www.alvdealer.com/catalog where i deactivated the thumbnail at the moment.

 

//$PHPTHUMB_CONFIG['document_root'] = 'http://www.alvdealer.com/catalog';
//$PHPTHUMB_CONFIG['document_root'] = '/catalog';
//$PHPTHUMB_CONFIG['document_root'] = $_SERVER['DOCUMENT_ROOT'].'/catalog';
//$PHPTHUMB_CONFIG['document_root'] = realpath((@$_SERVER['DOCUMENT_ROOT'] && file_exists(@$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])) ? $_SERVER['DOCUMENT_ROOT'] : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace($phpThumb->osslash, '/', realpath('.'))));
//$PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && ereg('^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))), realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace($phpThumb->osslash, '/', dirname(__FILE__))));

If you are not part of the solution, you are part of the problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...