Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On the Fly' Auto Thumbnailer using GD Library


Guest

Recommended Posts

Paulie, you probably want to turn on "calculate image size" in your osc config...

Hi Nate,

 

The Calculate Image Size option was already set to "true". I can't possibly think of anything else I could have missed. I assume my code on the previous page looks correct, and I have the Small Image Width and the Small Image Height set to 100. Just to confirm, the includes/functions/html_output.php file is the one in the Catalog folder and NOT the Admin folder, correct? I also have GD:

 

GD Support enabled

GD Version bundled (2.0.23 compatible)

FreeType Support enabled

FreeType Linkage with freetype

GIF Read Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

XBM Support enabled

 

The images are still out of proportion and I'm not sure what else to do. Any ideas at this point?

 

Thanks,

Paul

Link to comment
Share on other sites

  • Replies 313
  • Created
  • Last Reply

Top Posters In This Topic

Could you people stop posting scads of code, please? :rolleyes:

 

rankinworks, your shop is not even running the mod, so I have no idea what you're talking about... Right click on the thumbnails (or the intermediate-size image) and you'll see the image name is just imagename.jpg.... If you have have the mod running, the image name would be something like product_thumb.php?blah-blah...

 

Or, for the specific example, your image would be:

 

http://newmexicanconnection.com/shop/produ....jpg&w=100&h=70

 

Paulie, you likely have the same problem (since you have yet to provide an example, I can't say for sure) - check your image properties...

 

Not sure what either of you've done wrong, my only guess is that you haven't uploaded the html_output.php to the catalog's includes/functions/ directory... Or you've done some other mods which are bypassing the tep_image function...

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

well...i only used 3 contributions before this one...it just sounds like i should give up on yours because i have tried many changes and nothing seem to have worked.

 

i just wish those who got it to work would post something in here to say what they did or had to change.

 

 

adieu,

macie

Link to comment
Share on other sites

Hi rankinworks... the one's that have it working did nothing special except follow the instructions. If you simply swap out the tep-image function and add the one file, it should be a go... The actual scaling script works fine, as you can see from the link on your site - it just seems you don't have the modified html_output.php in the right place...

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

hi nate...

 

i tried to give it a GO again and same thing...the dimensions are the same for thumbnail 100x80 now b/c i put it back to the default admin config. the intermed image i removed. and the large pic is the same.

 

now...a question...how do you know that

 

The actual scaling script works fine, as you can see from the link on your site

 

you realize that i put the product_thumb.php in the shop/ root directory?

 

then you hint again that i did the edit for the html_output.php file wrong...i did paste the whole file onto my previous post and i will not do it again though. before, i didn't delete the following tep_image file following it b/c you then wrote in a reply that it should go UP to the tep_image_submit function (not to delete the image submit function, therefore, there was 2 parts to remove and add the file from the readme file).

 

the file is in the shop/includes/functions folder and not in the shop/admin/includes/functions ....

 

so what is there more for me to check out? i know that none of my other contributions i used had to do with thumbnailing images....most of it had to do with the information boxes.

 

can you suggest another thumbnail i can look into and try out perhaps? i am using the most recent osc version.

 

it's a shame that i can't figure what looks like a simple program...the easy population contribution had like 10 steps to do and i got it working okay but yours with on 2...i have a problem with GETTING it to function.

 

go figure...anyways...if you are on here at a certain time...please inform me so i can be on, and maybe you can assist me one on one if that's possible.

 

thank you.

 

adieu,

MACIE

 

p.s. i'm not a dumb blonde :P i want this to work badly.

Link to comment
Share on other sites

you realize that i put the product_thumb.php in the shop/ root directory?

 

Hi Macie,

 

No, I think what Nate was referring to was the fact that you got the scaling script to work on your site, because he was able to see that the image resized to a larger scaled image when viewing your product page. Not that he was actually able to view your files in their directories. The scaling script is working correctly on my site too, that's why I can't figure out why the other part of the mod that controls image proportions isn't working. If the scaling script is working, I would assume that the mod is installed correctly for both of us.

 

I'm still playing around with this and still getting nowhere. One thing I tried that I didn't try before, was to change the background color for the images. This function resides in the product_thumb.php file at the top, and the default color is white:

 

$r = 255; $g = 255; $b = 255;

 

I changed all the 255's to 100's, saved the file and reloaded the browser. Result? The background for the images did not change color, it remained white. SO, with that said, hopefully someone can troubleshoot THAT problem, which in turn will fix the resizing problem, becuase I strongly believe the two are related.

 

Just to confirm, does this mod look for the product images in the catalog/images folder? I just want to confirm I have my images in the default directory.

 

Also, I checked my image path, and it does not show product_thumb.php?imagename.jpg as Nate suggested it should, but instead it shows catalog/images/imagename.jpg. I too have followed the instructions exactly and I only have one other mod installed, which is Easy Populate. For image resizing, Nate's mod sounds like it is the best solution out there so far, and it really is a shame we can't get it working. I know there must be some users out there who have had the same problem and can provide the fix. But I can't wait around forever so I guess I will have to search around for another solution for now. But you can be sure that if I ever get it working, I will let you know immediately.

 

Best regards,

Paul

Link to comment
Share on other sites

Hi rankin (& Paulie ;)), I know the actual scaling works on rankin's site because of the direct link I posted to the image scaler on your website:

 

http://newmexicanconnection.com/shop/produ....jpg&w=100&h=70

 

(Paulie, you can try the same type of link directly to see if the scaling is working, too - which it probably is)

 

That is what the links *should* look like when you right-click and select Properties of any scaled image on your site. Yours do not look like that, so I can conclude the modified tep_image function is probably not in place, and/or you don't have "Calculate Image Size" set to "true"...

 

I'm not quite sure how the script could *not* work, frankly (particularly if you are using the latest version of osC) so I don't think anyone can offer any "tricks" - the only thing you might check is these lines:

if ((strstr($width,'%')!='') || (strstr($height,'%')!='')) { 
   $dont_calculate = 1; 
}

which look to see if the width/height specs have a "%" in them, and tell the tep_image function *not* to scale them (this is for blackline and transparent images, often set to 100%)

 

For troubleshooting purposes you could echo the $dont_calculate variable, to see what you're getting, or simply force it to be "0" by putting

$dont_calculate == 0;

After that "%" check to see if that's the problem (then find a fix)... Or (and this is a longshot) try replacing the percent check above with:

if (strstr($width,'%') == false || strstr($height,'%') == false) { 
   $dont_calculate = 0; 
} else {
   $dont_calculate = 1; 	 
}

... A slightly "cleaner" way to express the same thing... Though the strstr function's operation has been the same across PHP 3, 4 & 5, so like I said, it's a longshot ;)

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

(Paulie, you can try the same type of link directly to see if the scaling is working, too - which it probably is)

Hi Nate,

 

Firstly, thank you for bearing with us (me and Macie) throughout this problem.

 

I tried the same type of link as you suggested, and scaling is working as you had figured it probably was. So we're OK there. Next, I tried playing with the code you provided, but it didn't seem to have any effect on my images at all. However, I do have some new information. When I edited the border properties in the following code:

 

    $image = '<img src="' . $src . '" border="0" alt=" ' . htmlspecialchars(StripSlashes($alt)) . '  " title=" ' . htmlspecialchars(StripSlashes($alt)) . ' "';

 

by changing the border="0" to border="1", my product images DID get a border around them!

 

So now the question is, since the multiplier code works, scaling works, and changing the border size works, can I assume the mod is installed correctly? And if so, what would cause those things to work but not the background image color and image proportions? These seem to be the only two elements of the mod that aren't working. I hope this narrows it down a bit.

 

Thanks,

Paul

Link to comment
Share on other sites

Sorry, I'm out of suggestions - if you force the dont-calculate to zero and it still doesn't work - I'm absolutely stumped.

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

Nate, Paulie, et al...

 

I spent nearly a week on your contribution Nate...I even used the file you sent me and it didn't work, and I truly appreciate all your help on this matter.

 

Well, today, I removed your 2 files and installed the JPG Thumbnailer and it works great ...

 

**********

IF only you use .jpg for your product images and only .gif or .png for like your header, footer, boxes, and icons....otherwise if you do a .jpg image for the later parts...you will get a resized image and you don't want that. just make sure only your products that you sell are .jpg files and you won't have an issue.

**********

 

Now, in Jeff's file (the programmer who made JPG Thumb) for the resize.php [which has the similar effect to Nate's product_thumb.php file] there is a line to put in your image source with the url line:

 

$image = '<img src="http://www.yoururlhere.com/estore/resize.php?image=http://www.yoururlhere.com' . tep_output_string($src) . '&width=' . $width . '" border="0" alt="' . tep_output_string($alt) . '"';

 

which i tried to incorporate onto nate's product_thumb.php and then when i looked in index file of my store...had some error pertaining to the search program or button wasn't working.

 

my thinking nate, maybe a modification of your program would be a line like jeff's somewhere in yours to make it actually read the product_thumb.php file.

 

who knows...i'm not a programmer...but i followed jeff's instructions and it worked easily...so PAULIE...give it a chance.

 

i am in no way knocking your program nate...it has clearly worked for others...just not for me. i tried a multitude of ways and it was just just prompting to the product_thumb.php file.

 

i hope this helps those who had a problem getting it to work on your site.

 

adieu,

macie

Link to comment
Share on other sites

rankinworks, thanks but the contrib works fine and better than the one you suggested...

 

The mod you mention merely rescales the image and doesn't shrink the file size down, which is sort of the point of a thumbnailer... (if you have a 100K product image, it's still loads as a 100K thumbnail - with mine, it's shrunk to 2-3K) Why the contrib you went with feels the need to use an outside script to do a simple resize rather just do it right in the tep_image function is a bit of a mystery. Additionally, my contrib works with gif, jpgs and pngs.

 

The alternative you suggest is not a good alternative and I advise those who for some reason can't get my contrib to work to seek out the other, much better thumbnailing choices than the one you recommend (which isn't actually a thumbnailer).

 

Why you couldn't get my contrib to work is quite beyond me, but in my opinion, there are much better solutions to go with than the one you chose, and if you're happy, I'm happy :)

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

Nate is right about this. I have already tried that contribute before Nates, and I was not happy with the slow load times of the thumbnails. I saw another contrib that creates a thumbnail when the image is accessed for the first time, which is probably a better solution, but I would still rather try to get Nates contrib to work correctly if possible.

 

Nate, Macie mentioned that you had sent a file to try. Can you send it to me so I can give it a shot myself? I think I'm going to wipe everything out and start fresh again. On The Fly will be the first contribute I install so that I know there is nothing else that can conflict with it.

 

Thanks,

Paul

Link to comment
Share on other sites

nate...it is sooo funny that you still do not call me by my name which is macie and always rankin or rankinworks...well, that is besides the point.

 

i am very happy with my choice. as you can tell from my many posts on here and other sections of the forums, i was looking for answers everywhere and no where to be found. if you, the genius behind 'on the fly', couldn't figure out what the root cause could be to my particular predicament, then i certainly can't do it because i'm not a php programmer whiz...all i am is a mad scientist girl who is doing this site to sell new mexican chiles and spices--nothing more nothing less.

 

my decision on jeff's was a formality...since all the other programs didn't seem to do what they say...not to say yours does not...but the others i tried loaded up correctly but i didn't want to have extra folders being made labeled 'imagecache' or 'temp' etc...i just wanted something that would just resize for me automaticly so i don't have to do it myself. since you were out of suggestions...i had to find one on my own.

 

i'm sure you are correct in saying that jpg thumbnailer is not a resizing/thumbsizing program at all...well, that is such the case then. i don't know if it is or not. all i know is that it resizes my images for me...at least from the standpoint that it has a different size from thumbnail, medium, and large sizes.

 

your contribution in this program have helped plenty of folks and more to come.

 

thanks again for your hard work.

 

adieu,

MACIE

Link to comment
Share on other sites

Paulie, I sent my copy of the the html_output.php to you.... If it does not work, I urge you to try the troubleshooting with respect to the $dont_calculate variable mentioned a few posts back... (The version I sent includes the slightly improved logic mentioned back there)

 

rankinworks, there is nothing unusual with referring to forum members by their usernames. I don't see the humor. As for troubleshooting the problem you were having getting this to work, I did provide some direction but you either chose not to follow or did not provide adequate feedback, so there ya go.

 

I am truly stumped as to how it could *not* work frankly, the image references on your site indicated that you have not actually uploaded the html_output.php with the modified tep_image function...or your $dont-calculate was always "0" Paulie, if you ever get it working, please provide feedback as to what it was (even if it was something silly on your part - or mine - I won't laff!)

 

As I said, the solution you went with is not a true thumbnailer, merely an image scaler (and not a good one at that IMO) so I would not recommend it to others looking for an image thumbnailing (or even scaling) solution.

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

Hi Nate,

 

Thanks, but I still can't get it to work. :(

 

I'm going to "turn off" osCommerce in my control panel and then re-enable it, which should create a fresh default installation. If you want to take a stab at it yourself, I would be more than happy to PM you with access to my ftp and osCommerce admin so you can try to install it yourself and see if you can get it working (or perhaps figure out why it's not). If that's ok with you, please let me know and I will reset osCommerce and give you the login info.

 

Thanks,

Paul

Link to comment
Share on other sites

great mod... works great.

 

if anybody is having trouble with this working on thier server... maybe you need a new host?

i have a great webhosting company... and my sites are very fast and most scripts work on thier servers

Edited by The_Bear
Link to comment
Share on other sites

Well I am having a little issue I have pasted the code snippet into the required html file a number of times and I still get this error:

 

Parse error: parse error, unexpected '}' in /home/sites/supaosc.com/public_html/supasites/supasolutions/includes/functions/html_output.php on line 187

 

I have verified server is fine.

I have installe the required file to the root folder, so I have followed the instructions to the letter and still I have this issue.

 

Any help guys much appreciated.

Link to comment
Share on other sites

Just to verify I replaced this code with the one in the zip:

 

////

// The HTML image wrapper function

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

return false;

}

 

//

 

Is this right or wrong?

Link to comment
Share on other sites

joker, you have to replace the whole function...

 

Paulie, I need more input than "can't get it to work"... what about the $dont_calculate variable - what's that telling you?

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

Nate, I am sorry for the silly question, I had not followed the function till the end, I thk you for your trouble and I wish you all the best in the future.

Link to comment
Share on other sites

Paulie, I need more input than "can't get it to work"... what about the $dont_calculate variable - what's that telling you?

Hi Nate,

 

It didn't seem to make any difference when I added that code. Was I supposed to see an error message or something? After I changed the $dont_calculate variable to "0" I didn't notice anything different. Maybe I'm misunderstanding something here.

 

Thanks,

Paul

Edited by Paulie
Link to comment
Share on other sites

Nate, just a quick silly question I have no doubt, but I feel I must ask, am I supposed to do something else, I have installed the contribution and all works fine, well the site shows images, but the file size for thunb is the same size as the large image, I am missing some secret adjustment here which I cannot see in the readme plz enlighten me again.

 

Many regards

Link to comment
Share on other sites

Ok just a point to add I have the same contribution added to my other site as a test and it works fine mmmm, exact same changes just a diff list of installed contributions on my demo site main contibution b2bsuite, ,aybe something in here stopping it working right.

Link to comment
Share on other sites

Nate,

 

I'm beginning to wonder if this is a server platform issue? My server is running Windows 2000. Do you know if anyone is successfully using your contribute with Windows 2000 server?

 

Paul

Link to comment
Share on other sites

Nate,

I'm having a small problem with any product that has a ' in the title when you click on the product in the listing and it brings you to the product_info.php page i get this error.

 

A runtime error has occurred

Do you wish to debug?

 

Line:200

Error:Expected ')'

 

Any suggestions?

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