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

Hi

 

I love this great contribution, i only have one question where can i put at the product image size limit now i have pictures that are 1280 but is there away to limit it till 640 480?

 

Greets Lee

Link to comment
Share on other sites

  • Replies 556
  • Created
  • Last Reply

Top Posters In This Topic

where can i put at the product image size limit now i have pictures that are 1280 but is there away to limit it till 640 480?

Limit the image-size within popup_image.php? I Have not tested this, so make sure you test it properly before you change anything in a live shop ;)

 

In popup_image.php change

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

into

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], 1024, 768); ?>

and in product_thumb.php make sure that the variable $allow_larger is set to false.

 

Cheers,

Martijn.

Link to comment
Share on other sites

Thanks for your feedback.

 

As for your problem: it should work, but only since version 2.0 an aditional thumbnail-directory is supported. If you use version 2.1.2 the completely rewritten readme shows two sites where the contribution works for, and at least one store is located within root. This readme is also easier to follow when installing than the readme.txt that was included. Why not use that one?

 

Use the newer contribution-version and give me a link to your site (PM me if you want) and I'll help you out.

 

it is also not working for me ... speicaly when i modify any product... my site add is

http://www.imranseries.com/catalog/index.php... also i deleted the image from directory, rename it.. but still its not showing the image.

bit confused.. please guide me

Link to comment
Share on other sites

it is also not working for me ... speicaly when i modify any product... my site add is

http://www.imranseries.com/catalog/index.php also i deleted the image from directory, rename it.. but still its not showing the image.

bit confused.. please guide me :(

Looking at your site I see no reference to the auto thumbnailer contrib within the images. Did you replace the tep_image function in the html_output.php according to the readme? If so, please go through all steps of the readme again and make sure (not assume) you performed all required steps.

 

P.S. There's no need to delete or rename images, because this is an auto thumbnailer ;)

Link to comment
Share on other sites

Hi

 

I am sorry to say but I am still stuck on point 6 in the read me.

 

I did a search for tep_image and replaced the code but I am either deleting to much or to little of the original.

 

This is a clean install of OSC, any chance someone could send to me the correct file?

 

Many thanks

 

Wired

 

Figured it out 30s after posting!!! Was over writing the The HTML href link wrapper function.

Edited by Wired PSF
Link to comment
Share on other sites

Hi

 

Ok, almost sorted (!).

 

Images in the store are fine, but in admin they are still stretched. Only thing that I could not follow was:

 

replace code (around line 25)

 

 

define('DIR_WS_CATALOG_IMAGES', 'images/');

 

with code

 

 

define('DIR_WS_CATALOG_IMAGES', '../images/');

 

as my (clean OSC install) config file did not have the line. Closest was

 

define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

 

if I change it to ../images/ then the pictures break.

 

Any ideas?

 

Thanks

 

W

Link to comment
Share on other sites

I am having problems with featured products and OTF and the tep_image function. Which somebody may be able to hep.

 

I had an "ad" on an external website which used the code below to get image size and height and worked fine until I installed OTF??Not blaming here. But now just display hyperlinks>

 

For some reason it doesn't reconize SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT

 

code.

 

 

$featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<

 

I Have replace the tep_image in html_output so how can I reference height and width using the new tep_image function??

 

 

Regards

 

 

Gerard

Link to comment
Share on other sites

code.

$featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<

 

I Have replace the tep_image in html_output so how can I reference height and width using the new tep_image function??

With the information given it's not clear what you are trying to do and what your problem is. If all you're asking is "where are the height and width coming from", then the answer is simple. SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT are two configuration settings you can find in the admin area of your shop (step #7 of the installation instructions).

 

These two configuration values are stored in and read from the database and oscommerce puts the values in constants with the same name (SMALL_IMAGE_HEIGHT and SMALL_IMAGE_WIDTH). If another website has to know those values to make links, then the other website should have those constants declared too. Again: it's not clear to me which scenario is being used and what the *exact* problem is.

 

If you are going to do some more troubleshooting: if a constant is not declared, then most of the times php will use the name as an actual value. E.g.

 

echo MY_WIDTH; // -> will show MY_CONSTANT

define('MY_WIDTH','100');

echo MY_CONSTANT; // -> will show 100

 

I thought this might help you get an idea of what is wrong. If you still need help, please say what you've done so far, what happens (does the thumbnailer work on 1 server and not on another, do you have a url to look at) and what you expected to happen. Good luck.

Link to comment
Share on other sites

Images in the store are fine, but in admin they are still stretched. Only thing that I could not follow was:

 

replace code (around line 25)

define('DIR_WS_CATALOG_IMAGES', 'images/');

 

with code

define('DIR_WS_CATALOG_IMAGES', '../images/');

 

as my (clean OSC install) config file did not have the line. Closest was

 

define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

 

if I change it to ../images/ then the pictures break.

 

In oscommerce 2.2 MS2 in admin/includes/configure.php on line 25 it looks like this (default)

  define('DIR_WS_IMAGES', 'images/');

 

I don't know why it's different for you, maybe you have an earlier version of oscommerce or it was due to another contribution?

 

If you want me to have a look, send me a PM with the configure.php of your catalog and the one of your admin area. Please remove database info such as username and password, so I won't be tempted to login and steel your data :P

Link to comment
Share on other sites

Thanks for the reply,

 

what I have is an infobox on another site on the same server but different domain, which displays two thumbnails and a link to my catalog. This is a contrib called featured products, it works fine, with the normal html_output.file.

 

part of its code is below

 

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' );

 

when I replace the tep image function with yours, what happens is that the images disapear and I get two text hyperlinks instead.

 

If I remove SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT from the code $featured_products like below I get full size images being displayed in my info box.

 

$featured_products['products_name'] )

 

I have tried adding

 

define('SMALL_IMAGE_WIDTH','100');

define('SMALL_IMAGE_HEIGHT','122');

echo SMALL_IMAGE_WIDTH; // -> will show 100

 

which does echo 100 but does not apply the sizes to the images?

 

I have also tried

 

$image_width = "100";

$image_height = "140";

 

and replace small_image_width with image_width.

 

also tried just defining the size.

 

Any help would be appreciated.

 

 

Regards

Link to comment
Share on other sites

Correction of code on last post in page 8:

echo MY_WIDTH; // -> will show MY_CONSTANT
define('MY_WIDTH','100');
echo MY_CONSTANT; // -> will show 100

Should have been

echo MY_WIDTH; // -> will show MY_WIDTH
define('MY_WIDTH','100');
echo MY_WIDTH; // -> will show 100

Link to comment
Share on other sites

when I replace the tep image function with yours, what happens is that the images disapear and I get two text hyperlinks instead

Have you read the requirements? Have you got a proper gd-library installed so php can create thumbnails at all? What version of gd-library is installed?

 

If the gd-library is right, please send me: a link to your site (where I can find your 'special products' feauture installed) and your configure.php without database username and password.

 

Cheers,

Martijn.

Edited by mloeffen
Link to comment
Share on other sites

Have you read the requirements? Have you got a proper gd-library installed so php can create thumbnails at all? What version of gd-library is installed?

 

If the gd-library is right, please send me: a link to your site (where I can find your 'special products' feauture installed) and your configure.php without database username and password.

Cause of problem resolved: product_thumb.php was not uploaded >_<

Link to comment
Share on other sites

double checked and product_thumb is uploaded.

On luthier.co.uk you may have uploaded product_thumb.php, but certainly not on viollinbridges.co.uk. Like I said in my PM, you seem to be missing the point of what you have installed. Make an image-link from violinbridges to luthier.

 

Also, an error I noticed when clicking an image on violinbridges

Warning: main(phpgdv30/guard.php): failed to open stream: No such file or directory in <removed as requested - bluenotemkvi>/imtest.php on line 2

Fatal error: main(): Failed opening required 'phpgdv30/guard.php' (include_path='.:/usr/lib/php') in <removed as requested - bluenotemkvi>/imtest.php on line 2

 

Good luck :thumbsup:

Edited by BlueNoteMKVI
Link to comment
Share on other sites

thanks for spotting the error??

 

sorted now, but do you really need to post it to the world?????? a pm would have done the trick.

Didn't know it would bother you, sorry for that. I asked a moderator to edit the post, since I can't anymore.

 

And I'm glad to hear you fixed the problem with the incorrect link :thumbsup:

Link to comment
Share on other sites

very strange here:

Everything working on Firefox, Mozilla, Opera (Windows and Linux)

 

With Internet Explorer the small thumbs are working (reduced to 100x75) but the images in products_info are not shown.

 

Any hints on that ?

Link to comment
Share on other sites

With Internet Explorer the small thumbs are working (reduced to 100x75) but the images in products_info are not shown.

 

Any hints on that ?

Did you try to the 'extra tip' that enables a third images size for the product_info page? E.g. by multiplying the width and height with 2? If so, please verify you didn't make any typing errors.

 

It would also help if you post (or PM) the link to the broken images and a link to the page where the error occurs. I wonder if images are not shown or actually broken (with a red cross in Internet Explorer).

Link to comment
Share on other sites

I didn't use any mulitplier as I am showing the full picture size (removed the "click to enlarge")

 

html code within products_info page:

<img src="product_thumb.php?img=images/produkte/I368311.jpg&

w=hspace="5" vspace="5"&h=0" width="hspace="5" vspace="5"" border="0"

alt="TRANSCEND JetFlash 1024MB USBStick USB2.0 high speed blau"

title="TRANSCEND JetFlash 1024MB USBStick USB2.0 high speed blau">

 

html code within the products_new (or other pages with smaller images):

<img src="product_thumb.php?img=images/produkte/I368311.jpg&

w=100&h=75" width="100" height="75" border="0" alt="TRANSCEND JetFlash 1024MB USBStick USB2.0 high speed blau"

title="TRANSCEND JetFlash 1024MB USBStick USB2.0 high speed blau">

 

Wondering anyway that it's trying to do a "thumbnail in original file size rather then keep it as it is.

 

TIA

mfred

Link to comment
Share on other sites

Code from product_info.php

 

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

The error lies within the product_info.php. You did not include the width and height parameter for the tep_image function. So now the params-parameter is being passed as a width-parameter.

The code should be reading

 

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

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

 

Cheers.

Edited by mloeffen
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...