Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On The Fly' Auto Thumbnailer using GD Library 2.1


mloeffen

Recommended Posts

I got it to work in Firefox but not in IE, for some reason, the images display with a black background.

 

Sorry to dissapoint you Valentino, but Internet Explorer F-ing Up PNG transparency is a known and well documented bug. Having said that, there are workarounds, so all is not yet lost.

 

Now that you have put this issue into my mind, I have think that it is possible to integrate a fix (of sorts) into the contrib.

 

I'll code it up and see if it works....always the best way I find :D

 

Will let you know.

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

  • Replies 556
  • Created
  • Last Reply

Top Posters In This Topic

OK, the IE bug workaround seems to be doing the trick and has now been integrated into the new contribution. While I was at it I also altered the code so that PNG transparency is now preserved in thumbnails unlike the previous version.

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

I have installed this twice on a test site so that I dont mess my shop up and all I get is

 

Fatal error: Call to undefined function: tep_href_link() in /mnt/web_i/d14/s42/b0244bb2/www/zzz/nfoscomm/catalog/includes/application_top.php on line 467

 

When opening the site.

 

Also if I get this to work can I have the thumbnails to be a percentage of the size of the original as I dont want all my small images to be the same width or height.

 

Please help

Link to comment
Share on other sites

I have installed this twice on a test site so that I dont mess my shop up and all I get is

 

Fatal error: Call to undefined function: tep_href_link() in /mnt/web_i/d14/s42/b0244bb2/www/zzz/nfoscomm/catalog/includes/application_top.php on line 467

 

When opening the site.

 

Also if I get this to work can I have the thumbnails to be a percentage of the size of the original as I dont want all my small images to be the same width or height.

 

Please help

 

 

David, just restore your original /catalog/includes/functions/html_output.php file and then try again...following the instructions closely. You have messed up this part of the installation.

 

P.S You're not my I/S lecturor by any chance? :D

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

David, just restore your original /catalog/includes/functions/html_output.php file and then try again...following the instructions closely. You have messed up this part of the installation.

 

P.S You're not my I/S lecturor by any chance? :D

 

It was me I replaced to much code. It seems to be working now but I thought that the thumbnail would show when you see the list of products and then when you go into the product you would the correct size image. Instead I seem to get the small image when I go into the product description and only get the correct image size when I click to enlarge the image.

 

What I really want to have is two image size's so the thumbnail a percentage of the size of the original and the when you go into the product I want the original with no enlarge button.

 

and last of all

 

P.S You're not my I/S lecturor by any chance?

 

is that in cambridge?

Link to comment
Share on other sites

OK, the IE bug workaround seems to be doing the trick and has now been integrated into the new contribution. While I was at it I also altered the code so that PNG transparency is now preserved in thumbnails unlike the previous version.

That's great news Tom, really looking forward to giving it a go! :thumbsup:

 

However, I don't seem able to find the contribution download. Could you post a link here? Thanks.

Link to comment
Share on other sites

That's great news Tom, really looking forward to giving it a go! :thumbsup:

 

However, I don't seem able to find the contribution download. Could you post a link here? Thanks.

 

Sorry, not yet released - I had hoped to have it out a few days ago, but had other commitments - will be tomorrow.

 

see the list of products and then when you go into the product you would the correct size image. Instead I seem to get the small image when I go into the product description and only get the correct image size when I click to enlarge the image.

 

I think this is the idea of the contribution as most people only want a small version in the product list and the large version as a popup - There is a contribution out there that allows for an intermediate sized image to be shown on the product details page - not sure of the name (might be mo pics), but a little research should dig it up.

 

 

is that in cambridge?

No, David Whitely lectures in information systems at Manchester Metropolitan University. He has a few e-commerce type books out and is big into the whole thing.

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

David,

Don't bother with that extra contrib I mentioned, I will code an intermediate image size into the contribution which I will release tomorrow. This will alow seperate settings for the thumbnail to be displayed on the product info page.

Tom

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

David,

Don't bother with that extra contrib I mentioned, I will code an intermediate image size into the contribution which I will release tomorrow. This will alow seperate settings for the thumbnail to be displayed on the product info page.

Tom

 

 

Tom, I've been wrestling with this script and decided to put things aside for the moment and see what you're up to. Not trying to ask for help, just want to see more of your release.

I saw your example you showed and it looks very useful, so cheers for the fine work.

 

I trust it will be geared as a new contribution or addon to this one?

Additionally, will there be some nice instructions to go with?

 

For some reason I get hung up on the html_output, I might post my info and see if anyone could help.. *crosses fingers*

Link to comment
Share on other sites

Tom, I've been wrestling with this script and decided to put things aside for the moment and see what you're up to. Not trying to ask for help, just want to see more of your release.

I saw your example you showed and it looks very useful, so cheers for the fine work.

 

I trust it will be geared as a new contribution or addon to this one?

Additionally, will there be some nice instructions to go with?

 

For some reason I get hung up on the html_output, I might post my info and see if anyone could help.. *crosses fingers*

 

Hey Summoner,

This thing should have been released a few days ago, but have got a bit caught up with it - Feature creap and all of that.

Yes, indeed this will be a brand new contrib - I am calling it 'image magic'

There are actually 53 different configuration values and they all interact with each other in different ways, so I have spent the last day just testing and fixing.

I promise that it will be released later today (saturday).

Regards instructions, I have prepared, what I think to be, an extremely comprehensive readme. Also, there are not that many installation steps, so it should be easy enough to install

Best wishes

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Hey Summoner,

This thing should have been released a few days ago, but have got a bit caught up with it - Feature creap and all of that.

Yes, indeed this will be a brand new contrib - I am calling it 'image magic'

There are actually 53 different configuration values and they all interact with each other in different ways, so I have spent the last day just testing and fixing.

I promise that it will be released later today (saturday).

Regards instructions, I have prepared, what I think to be, an extremely comprehensive readme. Also, there are not that many installation steps, so it should be easy enough to install

Best wishes

 

You have just won my attention. Damn.. I'm already feeling impressed mate. I can't wait.

Those here in the open source community will aknowledge and appreciate such an achievement.

whew.. sounds like you've been really tinkering away at this little beast. :)

I honestly can't wait.

 

So it more or less processes the images the same method as this one, only has alot more options on 'how' to process those images?

heck, either way it sounds really good!! thanks alot for the reply tom! :D

Link to comment
Share on other sites

You have just won my attention. Damn.. I'm already feeling impressed mate. I can't wait.

Those here in the open source community will aknowledge and appreciate such an achievement.

whew.. sounds like you've been really tinkering away at this little beast. :)

I honestly can't wait.

 

Yeah, I know the feeling ;)

 

Tom, if you want I won't mind helping you beta-test your contrib. I've got some time left today and tomorrow and this contrib will end up in my sources the moment I can get my hands on it :thumbsup:

Link to comment
Share on other sites

hi tomjmul, thanks for the pointers so far, however...

 

in /catalog/product_thumb.php file, should we also find:

imagejpeg([b]$tmp_img[/b], '', 100);

and replace with:

imagejpeg($tmp_img, '', $quality);

 

and also find:

imagejpeg($tmp_img,$thumbnail, 100);

and replace with:

imagejpeg($tmp_img,$thumbnail, $quality);

?

 

The reason I ask:

I have all the quality settings set to 10% in admin for test purposes.

After clearing my browser cache and deleting all thumbs in my 'thumbnails\' folder, I have to do a Ctrl-F5 in Firefox to get it to display my thumbs at 10% quality (standard F5 still displays my images at 100%!)

After checking my 'thumbnails\' folder again, the thumbs have been regenerated with 100% quality! i.e. Shouldn't the 'thumbnails\' folder have my images at 10% quality?

Edited by march
Link to comment
Share on other sites

I have finally finished the new Image Magic contribution

 

What started as a few tweaks to the quality setting of this contribution has ended up with a week-long marathon and a contribution with 65 different configuration options (whew!) Image Magic should also fix the server caching difficulties many people using this contribution experienced.

 

If you want to get a better idea of Image Magic, or download it, go here: http://www.celtware.com/imagemagic/

 

The support thread for this contribution is here

 

Features: (from readme)

 

Image Thumbnailing - Image Magic will generate a smaller, much higher quality thumbnailed version of your product or category image before it is served to your customer. Not only will will your images look a great deal better than they did before, but your pages will load significantly faster and store will use less expensive bandwidth.

Image Magic will automatically maintain the aspect (width to height ) ratio of your images, so that distorted, product images will be a thing of the past. You only have to set a maximum width or height and image Magic will work the other out.

Server Caching - Image Magic uses very sophisticated techniques to ensure that your images load lightning fast. One of these is a server caching mechanism which means that once a thumbnail is produced for the first time, a copy of it will also be saved on the server. Rather than having to process and thumbnail the same image over and over again for each visitor, the cached copy will be sent instead.

Image magic will automatically categorize your cached thumbnails under a separate folder in exactly the same way you have them categorized in your images folder.

Server caching can be switched off if you have very limited server space.

Browser Caching - Another method Image Magic uses to give your site a speed boost, is to send special headers instructing your visitor's browser to make a locally cached copy of each image they view. This will have the effect of greatly cutting down the amount of repeat information you send each visitor and will mean your pages load much faster.

Automatic Cache Maintenance - Image Magic can detect old cached files which are no longer needed and automatically delete them from the server.

Admin Configuration - All configuration options are in the Admin Panel (Configuration -> Image Magic) rather than having to be set within the script header.

New Intermediate Sized Thumbnails - OSC Image Magic now introduces an extra thumbnail size which you can set from your admin panel, and which will be applied to the thumbnail images shown on your product information pages. Previously these were limited to being shown as small sized thumbnails, which were very often not suitable.

Output Quality Settings - The output quality of JPEG thumbnails can be specified for the various thumbnail sizes. This will mean much smaller file sizes so that your pages will load faster and use less bandwidth.

Image Watermarking - You can protect your images by embedding a semi-transparent graphic in them, such as your store logo etc. You can set the position, and transparency of the watermark within the thumbnail, and specify which thumbnails you want the watermark to appear in (such as only the large pop-up images)

Text Watermarking - You can use text watermarking instead of, or in addition to graphic watermarks. You can also upload your own Truetype fonts for use in your text watermarks, specify the colour, transparency, size and angle of the text and control which sized thumbnails to apply it to.

Image Filename Encryption - You can choose to encrypt the filename of your source images meaning that your visitors will never be able to see the actual filename of the images being served from your store. In combination with the watermarking functionality, this feature makes your images practically theft proof.

Brightness and Contrast Adjustment - Thumbnails can have their brightness and/or contrast increased or decreased by a user defined amount. This will happen on the fly.

Thumbnail bevelling - Thumbnails can be given a raised or receded 3D button effect on the fly. Precise control over button height/depth and 3D colouring is available.

Thumbnail Framing - Thumbnails can be given a 3D frame with a wide variety of styles and colours.

Transparency Preserved in Thumbnails - If you use images with a transparency channel or colour, this information will be fully preserved in the thumbnailed version.

Internet Explorer PNG bug workaround - Internet Explorer contains a well documented bug which messes up the alpha channel transparency of 24-bit PNG images. This contribution now has an option to switch on a work-around to this issue so that these types of images will display correctly.

 

This contribution has been submitted to the OSC team and is awating approval (filesize > 300k)

 

As this is version 1.0 Beta, there may still be a few snags which I have overlooked. If you come across any, please come to this thread and let me know.

 

Don't post them here - I do not wish to hijack this thread any more than I already have (Sorry Martin)

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Is there anybody that can help - I updated to version2.0 earlier today and have installed as instructed. It failed to work properly for me so I reverted back to my backed up files and I now keep getting the message "Unable to connect to database server!" The admin side restored perfectly ok, but the website did not.

 

Any advice greatfully received...

Link to comment
Share on other sites

Is there anybody that can help - I updated to version2.0 earlier today and have installed as instructed. It failed to work properly for me so I reverted back to my backed up files and I now keep getting the message "Unable to connect to database server!" The admin side restored perfectly ok, but the website did not.

 

Any advice greatfully received...

 

This sounds like a problem with your configure.php file

Check that the catalog/includes/configure.php database settings all look as they should.

I would suggest comparing them to your catalog/admin/includes/configure.php if that side is working fine

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Looks ok, but I've been staring at it for ages now. I can paste it up if you're willing to take a look. Would be muchly appreciated.

 

Chris

 

Chris,

 

Don't paste them up...they contain sensitive information. Check you PMs

 

Tom

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Looks ok, but I've been staring at it for ages now. I can paste it up if you're willing to take a look. Would be muchly appreciated.

 

Chris

 

1 Problem sorted - another rears its head. Now cannot access any product pages only the home page

 

HTTP404 Page Not Found error

Edited by chrisgrim
Link to comment
Share on other sites

For those who can only get the thumbnail chaching to work when you leave the $tn_path variable blank, I solved this probelm with the following change in product_thumb.php:

 

Find:

if ($tn_path=='') return $file;

else{

// append the thumbnail-path to the path

$pathSep = strstr(PHP_OS, "WIN") ? "\\" : "/";;

$path = reverse_strrchr($file,$pathSep);

if ($path===false) return $tn_path . $file;

else return str_replace($path,$path . $tn_path,$file);

}

 

Replace With:

if ($tn_path=='') return $file;

else{

// append the thumbnail-path to the path

if( strpos( $tn_path, "\\" ) !== false )

$pathSep = "\\";

else

$pathSep = "/";

$path = reverse_strrchr($file,$pathSep);

if ($path===false) return $tn_path . $file;

else return str_replace($path,$path . $tn_path,$file);

}

 

The file was assuming backslashes as I am on a windows server but the assumption was wrong. Seems PHP is perfectly capable of handling forward slashes on Windows 2003 Server.

 

voidstate

Link to comment
Share on other sites

I need some help please

I have installed 'on the fly' which works absolutely fine with all my catalog pictures.

2 problems though

Firstly the thumbnail do not store in the thumbnail folders that i have created ( not sure why) and

Secondly by buttons have gone really strange sometime they are there sometimes not and in my admin section some of the shop buttons are appearing????? really really confused please help!!

Link to comment
Share on other sites

Firstly the thumbnail do not store in the thumbnail folders that i have created

perhaps your 'thumbnails' folder isn't in the right place - it should be in your root (not in your 'images' folder). That's what got me stumped for a while.

Link to comment
Share on other sites

perhaps your 'thumbnails' folder isn't in the right place - it should be in your root (not in your 'images' folder). That's what got me stumped for a while.

Thanks March any idea on the mystery buttons!

paul

Link to comment
Share on other sites

Thanks March any idea on the mystery buttons!

paul

 

I have now created a folder

thumbnails in my root directory (will i have to manually have to move each thumbnail that has created in in my catalog/images directory into the root directory/thumbnails) there are hundreds.

 

I still am very co0nfused about my buttons as I have restored the old settings ( removed the products_thumb.php and restored the html_output yet my buttons are still all messed up!

 

PLease help!!

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