Jump to content
Sign in to follow this  
tomjmul

Support thread for the Image Magic contribution

Recommended Posts

put a curly bracket after the line

it should be:

function tep_image($src, $alt = '', $width = '', $height = '', $params = '', main=false) {

 

Sh1t, sorry....should be:

function tep_image($src, $alt = '', $width = '', $height = '', $params = '', $main=false) {

 

 

(I left out a $)

 

and this should be:

if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

if (isset($product_info['products_image']) 
&& $src == DIR_WS_IMAGES . $product_info['products_image'] && $main==true 
&& $product_info[products_id]==$_GET['products_id']) { //final check just to make sure that we don't interfere with other contribs
$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;
$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;
$product_info_image=true;
$page="prod_info"; 
}
}

 

 

That's what I get for switching between java, php, vb etc. :rolleyes:


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites
What about the watermark images, do they show up in the drop down list?

 

No the watermark pics are not showing up either.

Share this post


Link to post
Share on other sites
No the watermark pics are not showing up either.

 

The only advice I can offer without checking out your files is to make sure that your

 

DIR_FS_DOCUMENT_ROOT is properly set in /catalog/includes/configure.php

 

The code below in /catalog/admin/includes/functions/general.php should reference the directory where the watermark images are stored

 

DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks'

 

To test, you can always do an echo somewhere after the configure.oho file has been included

 

echo DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks';


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites
The only advice I can offer without checking out your files is to make sure that your

 

DIR_FS_DOCUMENT_ROOT is properly set in /catalog/includes/configure.php

 

The code below in /catalog/admin/includes/functions/general.php should reference the directory where the watermark images are stored

 

DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks'

 

To test, you can always do an echo somewhere after the configure.oho file has been included

 

echo DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks';

 

Tom, not only is your contribution great, but so is your support. Sorry to have bugged you with this issue. As soon as you recommended checking the DIR_FS_DOCUMENT_ROOT, I remember that I had changed that pointer to $DOCUMENT_ROOT to try and fix an issue with Easy Populate.

 

Anyways, all is working perfectly now... thanks again!!

Share this post


Link to post
Share on other sites
The only advice I can offer without checking out your files is to make sure that your

 

DIR_FS_DOCUMENT_ROOT is properly set in /catalog/includes/configure.php

 

The code below in /catalog/admin/includes/functions/general.php should reference the directory where the watermark images are stored

 

DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks'

 

To test, you can always do an echo somewhere after the configure.oho file has been included

 

echo DIR_FS_DOCUMENT_ROOT.'includes/imagemagic/watermarks';

Share this post


Link to post
Share on other sites
Tom, not only is your contribution great, but so is your support. Sorry to have bugged you with this issue. As soon as you recommended checking the DIR_FS_DOCUMENT_ROOT, I remember that I had changed that pointer to $DOCUMENT_ROOT to try and fix an issue with Easy Populate.

 

Anyways, all is working perfectly now... thanks again!!

 

lol, that'll teach ya :D


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

Tom,

 

:( Now my nice picture borders are gone........whaaaaa.

 

Karen

 

 

Sh1t, sorry....should be:

function tep_image($src, $alt = '', $width = '', $height = '', $params = '', $main=false) {

(I left out a $)

 

and this should be:

if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

if (isset($product_info['products_image']) 
&& $src == DIR_WS_IMAGES . $product_info['products_image'] && $main==true 
&& $product_info[products_id]==$_GET['products_id']) { //final check just to make sure that we don't interfere with other contribs
$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;
$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;
$product_info_image=true;
$page="prod_info"; 
}
}

That's what I get for switching between java, php, vb etc. :rolleyes:

Share this post


Link to post
Share on other sites

- Excellent contribution works great, thanks!

 

After first install on existing catalog with many pictures, is there a way to generate all thumbs at once, in order to populate the /thumbnails folder - instead of waiting that someone clicks on each product?

Share this post


Link to post
Share on other sites
- Excellent contribution works great, thanks!

 

After first install on existing catalog with many pictures, is there a way to generate all thumbs at once, in order to populate the /thumbnails folder - instead of waiting that someone clicks on each product?

 

You could use a link checker like Xenu to crawl your entire website. That would generate the images, and tell you at the same time if you have any broken links. :)

 

-jared

Edited by jcall

Share this post


Link to post
Share on other sites

Good idea, but I doubt it works as it seems that it needs you to clik on each independant product page, but I'll give it a try.

 

It would be more handy to be able to generate all thumbs at once without navigation.

 

But still, this not really very important, the con works great without that.

Share this post


Link to post
Share on other sites

link crawlers (including Googlebot) take a source URL, i.e. http://www.yourwebsite.com, and do an HTTP GET for /.

 

1) The webserver looks for a "default page", and will find index.php in an osCommerce shop (assuming that either index.php is listed first in your httpd.conf, or that you don't have index.htm or index.html, which are most often listed first).

 

2) The crawler parses the page it just recieved, and looks at all the objects in it. It does HTTP GETs for those objects, typically images.

 

3) The crawler parses the page looking for links. It will spawn a separate thread (depending on configuration/implementation of the bot) and follow the new link.

 

Don't be so pessimistic. Give it a shot. If I've missed something here, I'm happy to be educated, but I'm pretty confident that it will work.

 

If you find a better way, please let us know. We're all learning.

 

edit: Web servers have absolutely no clue what a click is. All they know is that they got an HTTP GET command (or POST, HEAD, whatever) and that they're supposed to respond to it. The browser is the only thing that cares if you clicked or not - - to send the GET/POST/HEAD/etc to the webserver.

 

-jared

Edited by jcall

Share this post


Link to post
Share on other sites
You could use a link checker like Xenu to crawl your entire website. That would generate the images, and tell you at the same time if you have any broken links. :)

 

-jared

 

 

That's a great idea Jared and it most definitely WOULD work. Will include your tip in the next version's readme.

 

Just one thing if anyone is going to do this. Make sure that your settings are all exactly the way you want them. Any changes to configs and the cache needs to be rebuilt.

Tom

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

When thumbnailed image's height OR width are smaller than defined in admin (if defined both small images width & height), the image was strecthed out in some pages such as in main page or products listing.

 

With this small fix it keeps it's original dimensions.

 

Look at the following code amendment, ( see //added by Expert .... )

 

	  // Set the width and height to the proper ratio
  if (!$width && $height) {
	$ratio = $height / $image_size[1];
	$width = intval($image_size[0] * $ratio);
  } elseif ($width && !$height) {
	$ratio = $width / $image_size[0];
	$height = intval($image_size[1] * $ratio);
  } elseif (!$width && !$height && !$over_ride) {
	$width = $image_size[0];
	$height = $image_size[1];
  }
// added by Expert in order to keep thumbnailed image proportions
  elseif ($width && $height) {
	  $ratio = $width / $image_size[0];
	  if ($image_size[1]*$ratio > $height) {
		$ratio = $height / $image_size[1];
		$width = $image_size[0] * $ratio;
	  }
	  else {
		$height = $image_size[1] * $ratio;
	  }
	if (($image_size[0] < $width) && ($image_size[1] < $height)) {
	 $width = $image_size[0];
	 $height = $image_size[1];
	}
 }
 // end Expert code

Edited by expert

Share this post


Link to post
Share on other sites

OK... having an issue:

 

Fatal error: Call to undefined function: tep_href_link() in /hsphere/local/home/jgerth/iowa-adirondack.com/catalog/includes/application_top.php on line 467

 

showed up each time after trying to install twice... and only after I installed the html_output.php file mods. can you shed any light? I didn't touch the file referred to... could it be conflicting somehow with another mod?

 

Thanks!

 

Jay

Share this post


Link to post
Share on other sites

WoW Tom, I am so impressed. Not only with this Fantastic Contrib and your Readme file, but your support.

I don't think I ever seen anyone stop and answer every single question!

 

Kudo's!

 

And Thanks So much for this great Add on!

Tim

Edited by snook789

Share this post


Link to post
Share on other sites

Tom - - ever seen issues when using text watermarking (haven't tried the graphical watermarking on that site yet)? I am working on one server where the images don't show up when I turn on watermarking.

 

More details later today if this doesn't ring a bell.

 

-jared

Share this post


Link to post
Share on other sites

Jared, that is the only problem I have (I didn't want to meantion it, as it isn't that big a deal to me)

 

Is the text watermarking doesn't work for me either.

Everytime I turn it on to test, the images are broken.

 

Watermark images, no problems

Share this post


Link to post
Share on other sites

Hey Tom, I'm SO close to getting my images to appear, I can taste it.... BUT I've read through most of the posts, and ran an image (that DOES have the imagemagic.php tag) and got this error:

 

Fatal error: Call to undefined function: fail() in /hsphere/local/home/jgerth/iowa-adirondack.com/catalog/imagemagic.php on line 25

 

which corresponds to this part of the code:

 

$dbconn=@mysql_connect($server,$user,$password) or fail(10);

 

Is it a problem in the database, then?

 

Thanks!

 

Jayson

 

iowa-adirondack.com

Share this post


Link to post
Share on other sites

I think there is a small bug in the tep_image code that is in the catalog\includes\functions\html_output.php file.

 

Here is the original code:

 

  // Decide whether or not we want to process this image
 if (($width == '' && $height == '' && $page != 'popup' ) || ($width == $image_size[0] && $height == $image_size[0] && $page != 'popup')) {  
	if (CFG_PROCESS_GRAPHICS=="False") $calculate = false; //looks like this is a store graphic rather than product image
 }

 

I think the

$height == $image_size[0]

needs to be changed to

$height == $image_size[1]

 

I copied your tep_image function over to the admin side of the website so that it would display my images for my products correctly. I am putting my images into subdirectories, and they would not display properly on the admin side. After I replaced the admin tep_image with the image magic version, then they displayed. However, the ocCommerce.gif image would not display (along with a few others), and I tracked it down to the code above.

Share this post


Link to post
Share on other sites

Hi,

 

Great contrib, and thank you for the easy install instructions, was an breeze to install this contrib.

 

However I have a strange problem, that appeared after I installed this contrib, how it I don't understand, but the text in header of the boxes in the left colum somehow are all aligned to the right. :o

 

Can you advice me how I can fix this?

 

my url is: www.jewelry-trends.com

 

 

Denice

Share this post


Link to post
Share on other sites

My excuus for posting again.

 

I installed this contrib in the root, this because I saw somewhere in the tread that it didn't matter. I think I understood that totally wrong, because when I try to us the watermark text I see that the fonts are installed in the /catalog/includes/imagemagic/fonts/ but it has to be /includes/imagemagic/fonts. Where can I change this, and is there more I need to change in regards to this, so that I can use all the features from this contrib for 100%

 

Denice

Share this post


Link to post
Share on other sites
Hi,

 

Great contrib, and thank you for the easy install instructions, was an breeze to install this contrib.

 

However I have a strange problem, that appeared after I installed this contrib, how it I don't understand, but the text in header of the boxes in the left colum somehow are all aligned to the right. :o

 

Can you advice me how I can fix this?

 

my url is: www.jewelry-trends.com

Denice

 

This problem I was able to fix, if you could help me out with my other post, I would appreciate it.

 

Denice

Share this post


Link to post
Share on other sites

hey tom,

loved the contribution, it worked great.

 

then i broke something. :/

 

plain vanilla os commerce, some sections were hacked to work with my postnuke installation. (headers, footers, etc)

 

then i installed Ultimate_SEO_URLs_v2-2.1d, and it worked.

then i installed the "3 Sizes of product images" hack.

 

what i was trying to do was get the site to quit storing all the product images in the same folder as cart and nav images and the like. i gave up on it. as i was looking for the solution i found imagemagic, and i installed it, and it worked :) .. well, i think it did :)

 

then i removed the "3 sizes" hack, and broke something severely.

 

restored to a clean version of every file involved, and reinstalled the seo hack, then imagemagic.

right now, everything works, with the exception of the product information page.

 

i click in, and the thumbnails work, as shown here:

http://www.paganality.com/catalog/household-c-213.html

that thumbnail is 100px wide, and using imagemagic.

here we get a missing image:

http://www.paganality.com/catalog/grand-cl...ing-p-5043.html

(i expected a 300px wide image)

the popup image on that page works fine.

 

the settings are:

Calculate Image Size true

Image Required true Info

Medium Image Width 300

Medium Image Width 300

Medium Image Height

Medium Image Height

Large Image Width 600

Large Image Width 600

Large Image Height

Large Image Height

Product Information Image Width 600

 

the doubled lines are an artifact from the 3 image hack i think, but it might be no sleep for 2 days and nightmares in php and perl :/

 

looking at "view source" for the product page, the link is showing img src="" for the image.

 

there was some confusion when i installed this.

 

instructions for /catalog/includes/functions/html_output.php say:

"replace the entire tep_image() function" and

 

"Find the first one directly below "// The HTML image wrapper function" (w/o quotes). Replace everything starting in between there till "// The HTML form submit button wrapper function" (w/o quotes) with the code you see above."

 

if i do that, it doesn't work, and i can't figure out why.. (view source says it breaks at:

script language="javascript"><!--

document.write('

 

currently your code is replacing from the function call all the way to the *first* instance of

$image .= '>';

return $image;

}

 

and works fine with this exception.

the instructions imply it should replace all the way to the second...

 

any idea what went wonky, or?

 

i could figure this out myself if i had a stock-with-your-modifications html_output.php file...

(can i suggest include it with the next release?)

 

my file is at http://www.paganality.com/catalog/includes...html_output.zip if you would like to look at it directly.

 

thanks!

-dd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×