Jump to content



Latest News: (loading..)

* * * * * 1 votes

'On The Fly' Auto Thumbnailer using GD Library 2.1


  • Please log in to reply
551 replies to this topic

#61   Bali Hai

Bali Hai
  • Members
  • 23 posts
  • Real Name:Dennis Dobbs
  • Location:Woodbrige, Virginia

Posted 18 October 2005 - 08:48 AM

To those who have their "catalog" installed in the root . . . that is, your product_thumb.php file is in the root directory.

If you get a "not found link" (x's) to the thumbnail image, check your path in your product_thumb.php file, ~ line 40.

My "thumbnails" directory is in the root, off my domain name. I changed line 40 from

Quote

$tn_path = 'thumbnails/'; // The default is 'thumbnails/', should be chmod 777

to

Quote

$tn_path = '../thumbnails/'; // The default is 'thumbnails/', should be chmod 777

Hope this helps.
Cheers :)

Edited by Bali Hai, 18 October 2005 - 08:50 AM.


#62   Brian-Bear

Brian-Bear
  • Members
  • 202 posts
  • Real Name:Brian
  • Gender:Male
  • Location:Northern Ireland

Posted 22 October 2005 - 09:50 PM

Hi
I am developing our shop on a live basis, all is good so far but I cannot get this contribution to work, I get the dreaded red X, no files appear to be generated in the thumbnails folder. All works well in our oscommerce setup so I think my configure file is OK. Our server is OK with the GD setup in server info.

Please someone help we are ready to go live

#63   Brian-Bear

Brian-Bear
  • Members
  • 202 posts
  • Real Name:Brian
  • Gender:Male
  • Location:Northern Ireland

Posted 23 October 2005 - 01:20 PM

Fixed
set $tn_path = '';
instead of $tn_path = 'thumbnails';

#64   legendthedog

legendthedog
  • Members
  • 2 posts
  • Real Name:Joe Lyons

Posted 23 October 2005 - 06:45 PM

Hi Guys,

Been using this contrib for the past 10 months or so and one problem that I have just learned to live with is that for some reason some of the images that are thumbnailed have no color whatsoever which makes them very difficult to see and puts people off. I've eventually got round to trying to sort this out. When you click on the thumbnail the image is fine. I am trying to determine whether this is a GD library issue or a contrib issue. Anyone else come across this before ?

#65   chrisytsma

chrisytsma
  • Members
  • 102 posts
  • Real Name:Chris
  • Gender:Male
  • Location:New York, USA

Posted 26 October 2005 - 12:03 AM

Just installed.  WOW! So awesome.

I did have a problem though. in my html_output.php file, there was an error where at the end, there was an extra "}". I got worried real quick and thought, damn, another crappy contrib that isn't yet ready... But then i deleted the "}" and everything is ok, code logic is fine now.

I have not tried to use it in admin, I dont think i will, it doesnt matter that much.
And I am going to try some of the Bonus Tips right now.

Thanks for the awesome work you guys. This is really really professional for a site to have this.

One note: it would be nice if once a thumnail is generated, when it was called by a page, it would have the file location be from the thumbnail directory, not product_thump.php......

Thanks again,
Chris

#66   chrisytsma

chrisytsma
  • Members
  • 102 posts
  • Real Name:Chris
  • Gender:Male
  • Location:New York, USA

Posted 26 October 2005 - 02:28 AM

OOPS, I lied. LOL. There is a problem.

GD Image Library seems to be removing whitespace from my images.
I have all of my images of size 640x480. And if i have a product image that isnt that large, i just paste it onto a 640x480 canvas and save it with white space around the actual image. What seems to be happening is that the images have most of the whitespace cut off of them, and then they are resized to 640x480. This causes the images to be of poor quality, showing a lot of jpeg artifacts. It is basically zoomed in. Maybe GD image library is a little too smart....

Can I turn this 'function' off somehow??

Chris  :lol:

#67   jwen

jwen
  • Members
  • 57 posts
  • Real Name:jay

Posted 26 October 2005 - 08:08 PM

Hi! I installed the great contribution n everything works fine except for using different explorers. It works perfectly in FireFox but a little bit problem when using IE. In IE when click the thumbnails it does display the actuall pixel image but without the scroll bar even the image is bigger than the screen. Any idea please?
you may try to access the link by yourself by clicking the right handside image. Many thanks!

Edited by jwen, 26 October 2005 - 08:09 PM.


#68   Hotwire

Hotwire
  • Members
  • 100 posts
  • Real Name:John Brent
  • Location:Petawawa

Posted 26 October 2005 - 08:13 PM

is there a way for me to add in a default image for items and catagories that do not have images uploaded. Like an "Image Coming Soon" Image or something.
++++++++++++++++++++
Im just a guy, Nothing more
++++++++++++++++++++

#69   chrisytsma

chrisytsma
  • Members
  • 102 posts
  • Real Name:Chris
  • Gender:Male
  • Location:New York, USA

Posted 26 October 2005 - 09:29 PM

View Postjwen, on Oct 26 2005, 04:08 PM, said:

Hi! I installed the great contribution n everything works fine except for using different explorers. It works perfectly in FireFox but a little bit problem when using IE. In IE when click the thumbnails it does display the actuall pixel image but without the scroll bar even the image is bigger than the screen. Any idea please?
you may try to access the link by yourself by clicking the right handside image. Many thanks!

Jwen, this is going to take some playing around with numbers, but in popup_image.php, there is a javascript that resizes the page when the image page loads. look below for the code:

function resize() {
  if ((navigator.appName == 'Mozilla') || (navigator.appName == 'Netscape')) i=8;
  if (document.images[0]) window.resizeTo(document.images[0].width+15,	document.images[0].height+96-i);
  self.focus();
}

Basically, play around with the numbers in IE first. Get it to look good with IE by changing the height to a higher number. see mine is 96.
Then, once IE looks good, you can set it up to resize correctly in Firefox by changing the "i" variable. Mine is set to 8, play with yours.

So, since you will be changing the script so that the height is larger, you will have to change the "i" variable to a greater number as well, since it is subtracted fromt he total height.

Also, may i recommend making your product images smaller? My screen resolution is 1280x1024 and the pic took up my whole page. for my store, i use 640x480 size pics, this is a good size... Or simply let the autothumbnailer do the work by setting a width and height specification in your image definition. I would show you how, but my code is completely different than the stock page because I have additional contribs installed.

See how mine works here

Chris

#70   jwen

jwen
  • Members
  • 57 posts
  • Real Name:jay

Posted 27 October 2005 - 12:33 AM

What a fantastic layout! I love the way u display your images!! If u dont mind can u show me which contribution do that thing or i have to do it manually please?

View Postchrisytsma, on Oct 26 2005, 10:29 PM, said:

Basically, play around with the numbers in IE first. Get it to look good with IE by changing the height to a higher number. see mine is 96.
Then, once IE looks good, you can set it up to resize correctly in Firefox by changing the "i" variable. Mine is set to 8, play with yours.

Thanks Chris! I tried with different number but nothing seems change. I think the 'over size' image produces the problem.

View Postchrisytsma, on Oct 26 2005, 10:29 PM, said:

Also, may i recommend making your product images smaller? My screen resolution is 1280x1024 and the pic took up my whole page. for my store, i use 640x480 size pics, this is a good size... Or simply let the autothumbnailer do the work by setting a width and height specification in your image definition. I would show you how, but my code is completely different than the stock page because I have additional contribs installed.
Thanks for your recommendation. My store currently beening tested only. I will resize all my images after its open. I just trying to find out a solution whether the problem can be fixed. Then sometimes we need to display really large images it will do the job. But I do appreciate your images layout! :thumbsup:

Edited by jwen, 27 October 2005 - 12:34 AM.


#71   dwepplo

dwepplo
  • Members
  • 20 posts
  • Real Name:Daniel Wepplo

Posted 30 October 2005 - 10:22 PM

Hi,

I've just installed this contribution and it seems to work great - I have a small problem with where it's storing the thubs - I can only get it to work if I change the "thumbnails"  to "" in the configuration.  I assume I have to fix something in a path somewhere.  

What I'd really like to know is if this contribution also has the option of using the watermark?

Honestly - I've looked and I've found a lot of people mentioning it but no useful information.  I think this is a great contribution - but the support threads are a kind of a nightmare with 3 offshoots of the orig contribution.  If someone could point me in the right direction I would appreciate it.  I'm sorry for posting if It's obvious and I've overlooked it.

Thank you,
Dan

#72   chrisytsma

chrisytsma
  • Members
  • 102 posts
  • Real Name:Chris
  • Gender:Male
  • Location:New York, USA

Posted 31 October 2005 - 10:17 PM

View Postjwen, on Oct 26 2005, 07:33 PM, said:

What a fantastic layout! I love the way u display your images!! If u dont mind can u show me which contribution do that thing or i have to do it manually please?

I used more pics 6 - http://www.oscommerce.com/community/contributions,1611
you will have to play around with the popup_image.php file code to organize it the way you desire.

Quote

Thanks Chris! I tried with different number but nothing seems change. I think the 'over size' image produces the problem.
Thanks for your recommendation. My store currently beening tested only. I will resize all my images after its open. I just trying to find out a solution whether the problem can be fixed. Then sometimes we need to display really large images it will do the job. But I do appreciate your images layout! :thumbsup:

It probably is your oversized images. The code may be being over-ridden by the browser since your images cause the popup_image page to display larger than your screen allows. Try resizing your image, this should fix the problem... Thanks for the compliment. Good day.
B)
Chris

#73   cleefor

cleefor
  • Members
  • 15 posts

Posted 04 November 2005 - 04:40 PM

Hi,

thanks for this contribution. But it unfortunately doesn't work with my shop!

There are no images shown...I simply followed the installation manual, added the product_thumb.php to my catalog dir and changed the tep_image function. I did not add a product_thumb.php to the admin dir, but it should work without one, too, right?

The /catalog/images/thumbnails dir is empty! What can i do now?

I use BTS! May this be the problem's reason?

#74   oblivion77

oblivion77
  • Members
  • 40 posts
  • Real Name:B Wade
  • Location:San Diego

Posted 05 November 2005 - 07:12 PM

I installed this mod on a couple of sites and it works great. The only thing that bothers me is the images that are auto generated are very poor quality, they look very pixelated and not nearly as clear as the original larger image. Does anyone know how to fix this? Is it something to do with GD or the contribution? You can see what I mean about the quality issue if you look at my website.

http://www.mediaessence.com/shop/accessori...ts-c-22_23.html

#75   cleefor

cleefor
  • Members
  • 15 posts

Posted 06 November 2005 - 02:17 PM

View Postcleefor, on Nov 4 2005, 05:40 PM, said:

Hi,

thanks for this contribution. But it unfortunately doesn't work with my shop!

There are no images shown...I simply followed the installation manual, added the product_thumb.php to my catalog dir and changed the tep_image function. I did not add a product_thumb.php to the admin dir, but it should work without one, too, right?

The /catalog/images/thumbnails dir is empty! What can i do now?

I use BTS! May this be the problem's reason?

I want to describe my problem more exactly:

- I use PHP5
- I use BTS 1.5
- I use OsCommerce in the newest version

The image's path is like this one: http://localhost/jm-versand/catalog/produc...jpg&w=111&h=120

man3itu.jpg is the name of the image I chose when creating the product. It is saved under http://localhost/jm-versand/catalog/images/man3itu.jpg ... But I've created a thumbnails directory.

If I enter http://localhost/jm-versand/catalog/produc...jpg&w=111&h=120 to Firefox address line the following message is shown: imagejpeg(): Unable to open 'thumbnails/images/man3itu.jpg.thumb_111x120.jpg' for writing in C:\apachefriends\xampp\htdocs\jm-versand\catalog\product_thumb.php on line 332

My configure.php looks like this:
<?php
/*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
  define('HTTP_SERVER', 'http://localhost/jm-versand'); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', ''); // eg, https://localhost - should not be empty for productive servers
  define('ENABLE_SSL', false); // secure webserver for checkout procedure?
  define('HTTP_COOKIE_DOMAIN', 'localhost');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/jm-versand/catalog/');
  define('HTTPS_COOKIE_PATH', '');
  define('DIR_WS_HTTP_CATALOG', '/catalog/');
  define('DIR_WS_HTTPS_CATALOG', '/catalog/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
  define('DIR_FS_CATALOG', 'C:/apachefriends/xampp/htdocs/jm-versand/catalog/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
  define('DB_SERVER_USERNAME', 'root');
  define('DB_SERVER_PASSWORD', '');
  define('DB_DATABASE', 'zugu');
  define('USE_PCONNECT', 'false'); // use persistent connections?
  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
?>


Please help me and let me know what more information you need! I'm working on this problem for days.

#76   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 06 November 2005 - 03:20 PM

In my opinion, there is no need to have the jpeg quality set at 100% as this can result in huge file sizes which can end up with the thumbnail being a larger file size than the original image.
If you want to adjust the jpeg image quality to a more reasonable value, for example 75%, replace all instances of  

imagejpeg($tmp_img, '', 100);

with

imagejpeg($tmp_img, '', 75);
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#77   swamiraj

swamiraj
  • Members
  • 2 posts
  • Real Name:Roger Leeper

Posted 06 November 2005 - 06:17 PM

By the sound of things, this is the contribution I need - I've installed it, but I need help getting things to work. Client store has various product photos that are either horizontally or vertically oriented - so pasting onto a common size canvas makes one group or the the other too small. With current small image settings (120x80) the tall group group thumbs are 'squished'. Hoping this is the right contrib for my dilema, and that the group can help me out. Here's where I'm at.

Server info:
osC: 2.2-MS2
php: 4.3.11
gd: bundled (2.0.28 compatible)

Config info:
Small Image Width: 120
Small Image Height: 80
Calculate Image Size: true
Image Required: true

product_thumb.php info:
CONFIG AREA
use_resampling = true
use_truecolor = true
gif_as_jpeg = true
tn_cache = true
r = 255
g = 255
b = 255
allow_larger = false
show_original = true

IN THE CODE
Uncommented the $filename and set with full path - (did this after some testing - produces the sames results as when not used)

CHMOD=755 (also tried 777 - same results)
Note: when I call this in the browser, I get a small 'Error' text that appears. Changing the text in the string (line 67) and uploading confirmed that this is generated by the php doc, and isn't server generated.

-----

thumbnails directory info:
Created 'thumbnails' directory in the 'images' directory inside the 'store' directory (osCommerce root) on server - both 'thumbnails' and 'images' are CHMOD=777

-----

includes/functions/html_output.php info:
Copy / paste to 'Replace your function tep_image code with the code below'
CHMOD=644

-----

At this point, the functionality of the store is still the same - nothing has blown up, but I'm not getting the desired result either. What did I miss / screw up / forget?

TIA for any light you can shed - I'm in south Florida, post Hurricane Wilma, still without power save for my neighbors generator - gettin' tired of spending all my time in the dark.

#78   tomjmul

tomjmul
  • Members
  • 196 posts
  • Real Name:Tom Muldown
  • Location:Ireland

Posted 07 November 2005 - 02:32 AM

View Posttomjmul, on Nov 6 2005, 03:20 PM, said:

In my opinion, there is no need to have the jpeg quality set at 100% as this can result in huge file sizes which can end up with the thumbnail being a larger file size than the original image.
If you want to adjust the jpeg image quality to a more reasonable value, for example 75%, replace all instances of  

imagejpeg($tmp_img, '', 100);

with

imagejpeg($tmp_img, '', 75);


One thing I should add, is that if you are using JPEG source images, and decrease the quality of the thumbnails using the above, then it might be best to save them at 100% quality. This will avoid having them JPEG compressed twice and result in better quality.
OSC Image Magic
On-the-fly thumbnails, watermarks and image processing

#79   Avec

Avec
  • Members
  • 817 posts
  • Real Name:Jeffrey Todd
  • Gender:Male

Posted 08 November 2005 - 02:51 PM

I am having the same problems as others.  Followed installation exactly - did not enable for admin section.  Thumbnails directory is empty, no thumbs show on page.  Page Icons, stock and custom, do not show as well.  I am using osCommerce 2.2 with STS.  Help will be appreciated.

#80   oblivion77

oblivion77
  • Members
  • 40 posts
  • Real Name:B Wade
  • Location:San Diego

Posted 08 November 2005 - 08:04 PM

View Posttomjmul, on Nov 6 2005, 06:32 PM, said:

One thing I should add, is that if you are using JPEG source images, and decrease the quality of the thumbnails using the above, then it might be best to save them at 100% quality. This will avoid having them JPEG compressed twice and result in better quality.
Tomjmul,

Thanks so much. This was one of those little things that was bugging me for over a year. What I found is that if I set it to 93 it is equivalent to the adobe photoshop "save for web at 72 quality" which is how I save all my jpegs.  My images look so much better.  :thumbsup:

imagejpeg($tmp_img, '', 93);