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

Haven't tested the new code, but I think you understand the reason for the missing thumbnail.

Hi,

 

ok I understand where the problem is but readding SMALL_IMAGE_* is shrinking my pictures again from original size. Is there any other workaround for it?

 

Still strange its only a IE problem :/

 

bye,

mfred

Link to comment
Share on other sites

  • Replies 556
  • Created
  • Last Reply

Top Posters In This Topic

ok I understand where the problem is but readding SMALL_IMAGE_* is shrinking my pictures again from original size. Is there any other workaround for it?

Try this instead to maintain normal image size

 

<td align="center">
<?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], '100%', '100%', 'hspace="5" vspace="5"'); ?>
</td>

 

Still strange its only a IE problem :/

Microsoft :-"

Link to comment
Share on other sites

Try this instead to maintain normal image size

 

<td align="center">
<?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], '100%', '100%', 'hspace="5" vspace="5"'); ?>
</td>

Microsoft :-"

 

% is not working as it is resizing to the table width/height.

 

For now I just filled with 200, 150 as until now all my pictures are of the same size.

 

THX 4 your help!

 

mfred

Link to comment
Share on other sites

Does anyone know a way to make my resized .jpg appear with a black background, currently it is white.

This was the resize code I added.

 

if (empty($allow_larger) && ($_GET['w'] > $image[0] || $_GET['h'] > $image[1]))

{

// existing image is smaller than thumbnail so create the thumbnail

// with the smaller original image centred on it

$dx = ($_GET['w'] - $image[0]) / 2;

$dy = ($_GET['h'] - $image[1]) / 2;

imagecopy($tmp_img, $src, $dx, $dy, 0, 0, $image[0], $image[1]);

} else

if (function_exists('imagecopyresampled') && $use_resampling)

{

 

I am not a programer so I am not sure how to add this myself. I tried to change the gif background values at the top of the page, but I am sure they are not related to .jpgs, any help would be much appericated, even after about an hour of reading about GD I am still unsure on how to add this feature.

Link to comment
Share on other sites

oddly I changed the image size, and now my background is black, thanks for the contrib it has been a real help esp cause I have changed my picture sizes alot.

 

Does anyone know a way to make my resized .jpg appear with a black background, currently it is white.

This was the resize code I added.

 

if (empty($allow_larger) && ($_GET['w'] > $image[0] || $_GET['h'] > $image[1]))

{

// existing image is smaller than thumbnail so create the thumbnail

// with the smaller original image centred on it

$dx = ($_GET['w'] - $image[0]) / 2;

$dy = ($_GET['h'] - $image[1]) / 2;

imagecopy($tmp_img, $src, $dx, $dy, 0, 0, $image[0], $image[1]);

} else

if (function_exists('imagecopyresampled') && $use_resampling)

{

 

I am not a programer so I am not sure how to add this myself. I tried to change the gif background values at the top of the page, but I am sure they are not related to .jpgs, any help would be much appericated, even after about an hour of reading about GD I am still unsure on how to add this feature.

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:

Replace With:

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

 

You hit it on the nail (pardon the pun) - thanks voidstate.

 

I must admit this one had me stumped - I setup my local dev.server last week, and after a bit of a frustrating learning curve I had everything working perfectly - EXCEPT for the thumbnails. Strange was that the full size picture (i.e. click here to enlarge) show perfectly, but no images on any thumbnails - the sizes were right but just no rendering.

 

This fix worked 100% - Thanks a million!!. :thumbsup: :thumbsup: B)

Never underestimate the power of stupid people, especially in groups.

Link to comment
Share on other sites

You hit it on the nail (pardon the pun) - thanks voidstate.

 

I must admit this one had me stumped - I setup my local dev.server last week, and after a bit of a frustrating learning curve I had everything working perfectly - EXCEPT for the thumbnails. Strange was that the full size picture (i.e. click here to enlarge) show perfectly, but no images on any thumbnails - the sizes were right but just no rendering.

 

This fix worked 100% - Thanks a million!!. :thumbsup: :thumbsup: B)

 

I was refering to Post #120 in this support forum ('On The Fly' Auto Thumbnailer using GD Library 2.1)

Never underestimate the power of stupid people, especially in groups.

Link to comment
Share on other sites

Now I have read the entire thread and still I am lost.

 

I have tried to install this contrib twice, and it simply won't work. I have tried the thumbnail folder tricks and everything else I have found here, but my thumbnails still won't show.

 

PHP Version: 4.3.11

osCommerce: 2.2-MS2

GD Version: bundled (2.0.28 compatible)

 

I have done the installation by the letter, twice, read this entire thread for help, but still there is no images. I bet there is a crappy liiittle mistake I have made, but I can't find it. My customer wants to start using her webshop soon so it is a bit urgent. PLEASE HELP ME! :(

 

The image url seems correct:

img src="product_thumb.php?img=images/DSC01636.JPG&w=100&h=75"

 

or isn't it?

 

My testshop is here: http://www.sirlig.se/shop

Link to comment
Share on other sites

I'm confused as to how this problem is related to On the Fly, but it is somehow.

 

Here's the problem:

 

http://inhealth.tempwebpage.com/catalog/in...php?cPath=14_36

 

See the double titles? Not cool. I know the problem involves On the Fly because when I replace the altered html_output.php with the original, the problem goes away. The fact that nobody else has posted this problem leads me to believe that it's some kind of conflict with another contrib I have installed. But none of the other contribs I have needed to edit html_output.php!

 

I've debated just nuking the titles altogether in index.php... but yeah. I'd rather have it fixed.

 

Thanks for any help!

 

-Daniel

Link to comment
Share on other sites

hey,

 

i've installed this nice contrib, works superb on the catalog side, it also works on the admin side, but not all the way. Some images in admin are missing (like the 'online catalog'-image on the right top corner in admin) and there are no flags visible, e.g. on the edit-pag of a product at Products Name.

 

i read the whole topic, there is no word or info on this problem

Link to comment
Share on other sites

hey again :)

 

forgot to tell:

installed version is(/was for admin side) OTF2_1_2b with bugfix for osc2.2 M2

 

now i'm running this contrib only at the catalog side, leaving me out of proportion images in admin :P

 

this contrib, however, is worth (temporarily?) this backside :Y)

Edited by joep147
Link to comment
Share on other sites

Trying this contribution on a new/test install. I have run into a problem with the thumbnailed images loosing their color. It is not consistant, but only a few out of the 30 or so I have installed into the test catalog. If you click to enlarge the image, the color is displayed properly.

 

Here is a sample link

 

http://www.bigmoosemall.com/bta/product_in...&products_id=63

 

Thanks for any info!

Link to comment
Share on other sites

I'm trying to use the "Display OSC products in Mambo" contrib (or the "Infoboxes outside OSC" contrib), but the thumbs don't display in the box outside of the OSC install. I have a thumbnail-sized "No Image" image, which displays, but any product image that there is actually an image for, will not display.

 

After checking the image source, it was trying to pull http://mysite.com/otherdirectory/product_t...mg=images/ETC... , rather than pulling the image from the shop directory.

 

I have modified the code so that it would call from the shop directory, but apparently what I did didn't work all that great, as the images show now, but it is pulling the full-size image and then resizing it.

 

Any ideas?

Link to comment
Share on other sites

  • 2 weeks later...

Hello all i wonder if you can help - ive installed the auto thumbnailer contribution and it seems to haver worked for some of my images in the shop but not the rest looking on the server all of the product images are in the same folder (catalog/images/) not sub directories but i can not work this out - please help!!!!

Link to comment
Share on other sites

Hi, first i like this Contribute! Good work!!!

 

Now my problem :blush:

 

I upload my products with a full path for the images.

Like: http://www.fixversand.de/ebay/dema/d94009.jpg

 

This is because we got a few different shops with sometimes the same products. I don't want to store the same image on X different locations. :thumbsup:

 

Normaly OSC can't handle this.

So i added some code to the products_thumb.php (start line 98):

 

	global $use404, $tn_browser_cache;

if (isset($_SERVER["SERVER_PROTOCOL"]) && $_SERVER["SERVER_PROTOCOL"] == "HTTP/1.1") 
	$httpProtocol = "HTTP/1.1";
else
	$httpProtocol = "HTTP/1.0";

if (substr($file,0,30) == 'http://www.fixversand.de/ebay/') {
	$filesubstr = str_replace(substr($file,0,30), '',$file);

	if (copy($file, 'images/' . $filesubstr)) {
		$file = 'images/' . $filesubstr;
	} else {
		// Copy failed. display a noimage.jpg --- not working
		$file = 'images/default/keinbild.jpg';
	}
}

 

When i visit the products_thumb.php directly the image is copied and a thumbnail is shown. (cache mode)

http://testshop.fixsi.de/product_thumb.php....jpg&w=91&h=100

 

 

But if i visit the products_info.php nothing is shown or copied.

Even the call in the info.php is the same as the one i showed above!

Any idea where the bug can be?

 

 

Ah and another thing.

After the thumbnail is shown in the browser the copied image should be deleted again.

i tried this with:

	unlink('images/' . $filesubstr);

 

at the end of the products_thumb.php. But nothing happens. :huh:

Link to comment
Share on other sites

  • 1 month later...

Hello,

I took OTF and installed it on my website. I installed the default image option, it displays a default image when a product image is not found. It worked perfectly fine. Then I ran into a problem with an update from my inventory provider, and after the next successful update the thumbnailer ceased to work.

What happens is for images that dont exist the default image is shown, but for images that DO exist, it shows a broken image link. Someone please help. I am having a lot of trouble. I was supposed to roll my new store out 2 weeks ago, and I cant because of this and other mishaps.

 

So you can see what exactly I am talking about check out my store, at www.pcpluscorp.com.

 

Thanks,

Rick

Link to comment
Share on other sites

Hello,

I took OTF and installed it on my website. I installed the default image option, when it displays a default image when a product image is not found. It worked perfectly fine. Then I ran into a problem with an update from my inventory provider, and after the next successful update the thumbnailer ceased to work.

What happens is for images that dont exist the default image is shown, but for images that DO exist, it shows a broken image link. Someone please help. I am having a lot of trouble. I was supposed to roll my ew store out 2 weeks ago, and I cant because of these mishaps.

 

So you can see what exactly I am talking about check out my store, at www.pcpluscorp.com.

 

Thanks,

Rick

Link to comment
Share on other sites

Hi-

 

product_thumbs.php cause mod_evasive to flip and block requests, especially on pages producing alot of thumbs.

 

This is cited on this thread too:

 

http://www.oscommerce.com/forums/index.php?showtopic=122761

 

Any help on that front?

 

Here's my mod_evasive parameters:

 

DOSHashTableSize 3097

DOSPageCount 100

DOSSiteCount 500

DOSPageInterval 1

DOSSiteInterval 1

DOSBlockingPeriod 1

 

I know its not the safest, but I figure DDoS attacks are generally pushing alot more requests than whats here...

 

Any help appreciated...

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

i've installed this contrib and everything seems to be working ok. The thumbnail images are looking much cleaner and less jagged.

Am i correct in thinking that all i do in admin is to set the width and height of the to pixel dimensions?

Or does this have to be a %?

Presumably all the images uploaded will be placed in the new tumbnails folder too?

 

Does anyone know why the download time of the site is now increased?...everything is loading incredibly slowly!!!

 

Thanks for any help.

 

J

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Auto Thumbnailer works great!

Maybe too great however.

The way it's set up now ANYONE can resize and display his images using my server.

 

Does anyone know of a way to change product_thumb.php so that it'll only resize images which originate from within my domain name or server?

 

Having product_thumb.php resize any image thrown at it as it is now is just asking for abuse by spammers...

Link to comment
Share on other sites

Hello

 

Thanks for a good mod.

 

I've installed the mod, but i have a problem.

 

For some reason index.php doesn't show the thumbnail, it shows the orginal image(!)

 

On product_info.php, products_new.php, everything looks good. And the thumbnail is ok.

 

Any idea how to fix this ? Or where to look to find out what is wrong ?

 

Thanks again for a great mod and a great community.

 

 

Regards

 

Akvario

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