Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for the Image Magic contribution


tomjmul

Recommended Posts

Hello Tom,

 

Many thanks for this great contribution.

This is my experience with http://affiliatesexcel.com

 

Tom, can I make a suggestion. You should replace the ampersands (&) inbetween get variables in the tep_image output with & as this can make the html/xhtml invalid.

 

Maybe you could incorporate this into the next release?

 

Scott

 

I guess it had to do with the ampersands (&) in the code section as

these were high lighted by my PHP editor. as I am not a php expert

I couldn't figure out.

 

ImageMagic seems to be working but I have a couple of observations.

 

When the ENCRYPTION was turned on when IM was first activated,

it seemed to load images faster and most of them.

It took about an hour before most images were loaded.

 

Turning the Image frame option on Helped to see quickly that

IM is working and new images are loaded (faster than checking to

see the URL of each image)

 

When later the encryption option was turned off it has taken

much longer for the images to load and some images are still missing

after several hours.

 

I have deleted the cache in my local machine to make sure

new images are saved. I have set TWO other options this time,

Convert GIF to JPG and reduce quality to 80%

 

Wonder if these setting create the extra time delay?

 

+++++++++

THE I?M admin option 2 states that all images in the store

will be processed. DOes this mean all images in the images directory?

 

I have turned this option on (as our site is IMAGE based with several

large Images) so that the whole pages will load quicker.

 

Could you please clarify if IM will process ALL images ?

Link to comment
Share on other sites

  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

this is a freekin great addition to an already great script... kudos

 

i am having trouble though showing the images, they all seem to be sized right but the images are broken in the spot where they should be. i checked the URL of the broken images to see where they are being called from and when i go to that url i get this error

 

Warning: mkdir() failed (Permission denied) pathtosite/catalog/imagemagic.php on line 374

 

i have no idea what could be causing this as the pics i had in there before were uploaded and were showing fine before i added this mod, anybody have any ideas?

Link to comment
Share on other sites

Hi, Tom!

I've just installed this contrib and the url doesn't have imagemagic in the path.

I created a dir called "thumbnails" and chmoded to 777.

Please see My Webpage

This is config of the image magic

 

Image Magic Master Switch On

Process Store's Graphics True

Auto Clean Cache True

Encrypt Image Filenames False

Filename Encryption Key changeme

Apply Internet Explorer PNG Transparency work-around? True

Use Resampling True

Create Truecolour Thumbnails True

Output GIFs as JPEGs False

'GIF as JPEG' Matte colour (HEX) FFFFFF

Cache Thumbnails on the Server True

Cache Thumbnails in user's browser True

Thumbnail Cache directory /thumbnails

Use 404 Response if image not found? False

Allow thumbnails larger than original True

Center if thumbnail larger than original False

JPEG Quality - Pop-up Images 60

JPEG Quality - Product Information Thumbnails 50

JPEG Quality - Category Thumbnails 50

JPEG Quality - Heading Thumbnails 50

JPEG Quality - Small Thumbnails 50

Graphic Watermark in Pop-up Images No

Graphic Watermark in Product Information Thumbnails No

Graphic Watermark in Category Thumbnails No

Graphic Watermark in Heading Thumbnails No

Graphic Watermark in Small Thumbnails No

Watermark Image File

Image Watermark Transparency 20

Image Watermark Position Center

Image Watermark Margin 0

Resize Watermark Image True

Text Watermark in Pop-up Images No

Text Watermark in Product Information Thumbnails No

Text Watermark in Category Thumbnails No

Text Watermark in Heading Thumbnails No

Text Watermark in Small Thumbnails No

Watermark Text JETNET Computers

Text Watermark Font Name arial.ttf

Text Watermark Size 10

Text Watermark Colour (HEX) 000000

Text Watermark Transparency 20

Text Watermark Position Center

Text Watermark Margin 0

Text Watermark Angle 0

Auto Adjust Brightness 0

Auto Adjust Contrast 0

Frame Pop-up Images No

Frame Product Information Thumbnails No

Frame Category Thumbnails No

Frame Heading Thumbnails No

Frame Small Thumbnails No

Frame Width 4

Frame Depth 4

Frame Colour (HEX) CCCCCC

Frame Inside 3D Highlight Colour (HEX) FFFFFF

Frame Inside 3D Shadow Colour (HEX) 000000

Buttonize Pop-up Images No

Buttonize Product Information Thumbnails No

Buttonize Category Thumbnails No

Buttonize Heading Thumbnails No

Buttonize Small Thumbnails No

Button Height 4

Button Highlight Colour (HEX) CCCCCC

Button Shadow Colour (HEX) 000000

 

This is config of the images

 

Small Image Width 150

Small Image Height 0

Heading Image Width 60

Heading Image Height 0

Subcategory Image Width 150

Subcategory Image Height 0

Calculate Image Size true

Image Required true

Product Information Image Width 100

Product Information Image Height 0

 

Thanks

Vlad

Edited by Scully
Link to comment
Share on other sites

Hi Tom,

 

This is a really great contrib and I have been able to get everything working except for the thumbnail cache.

 

Here's my story:

 

I'm using the Content Management system PHPnuke with OSC intergrated into it (www.osc2nuke.com). OSC contributons usually integrate just fine with small path modifications. Yours is especially nice in that way because it is a simple mod. I have been able to implement the contribution just fine with a modification to the path html_output.php file, but I am having a problem with the thumbnail cache creation. The script is located in the directory http://www.fourmattech.com/osc2nuke2/html/.../imagemagic.php. I have tried various locations in the admin for the thumbnail directory from /thumbnails to thumbnails (among others) without the / to the full path. I have created thumbnail directories in just about every folder from the root, down to the images under the catalog and made sure that the permissions were set to 0777, but no matter what I do, I get the following statement when I go to view the image that was supposed to have been generated:

 

 

thumbnails/modules/catalog/imagesthumbnails/modules/catalogthumbnails/modulesthumbnails.

Warning: mkdir(thumbnails): Permission denied in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 374

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 487

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 488

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 489

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 490

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 491

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php:373) in /home/fourm3/public_html/osc2nuke2/html/modules/catalog/imagemagic.php on line 492

 

 

 

I changed the code to add

echo "$path";

just above line 374 and as you can see from the top of the code, it's trying to find the right folder, but it is having problems.

 

Where exactly is the path designation for the script to find the thumbnail directories? Is there a location where I can hard code the beginning of the thumbnail path or the location where it needs to start looking?

 

Any help would be appreciated.

 

http://www.fourmattech.com/osc2nuke2/html/index.php

 

this is a freekin great addition to an already great script... kudos

 

i am having trouble though showing the images, they all seem to be sized right but the images are broken in the spot where they should be. i checked the URL of the broken images to see where they are being called from and when i go to that url i get this error

 

Warning: mkdir() failed (Permission denied) pathtosite/catalog/imagemagic.php on line 374

 

i have no idea what could be causing this as the pics i had in there before were uploaded and were showing fine before i added this mod, anybody have any ideas?

 

 

You need to turn off the thumbnail cache. Read through the other section of this forum, and then through the readme file to find out how to get the thumbnail cache working for you.

Link to comment
Share on other sites

So is there a way to get this to work with the images in the Admin section also or not?

 

 

No, I removed admin functionality - try the first release

 

I have installed this contribution but am not sure it is working.

It seems to have slowed the site. On checking the error log I get this.....

 

You may find that images load a little slower at first until i/m is able to build a comprehensive cache.

Don't worry about the notices.

 

just above line 374 and as you can see from the top of the code, it's trying to find the right folder, but it is having problems

 

As has been said many times both on this forum and in the readme, if you are having problems, then manually create the thumbnail directory and chmod to 777. I/m should have no problems then creating the subfolders as needed.

 

Vlad,

If imagemagic.php is not appearing in the url of your images, then try reinstalling as this is most often the problem - specifically the code into the catalog/includes/functions/html_output.php file. Make sure that you did not install it admin side.

 

i am having trouble though showing the images, they all seem to be sized right but the images are broken in the spot where they should be. i checked the URL of the broken images to see where they are being called from and when i go to that url i get this error

 

Warning: mkdir() failed (Permission denied) pathtosite/catalog/imagemagic.php on line 374

 

sigh......see above on how to manually create the thumbnail cache base dir

 

 

 

Tom, can I make a suggestion. You should replace the ampersands (&) inbetween get variables in the tep_image output with & as this can make the html/xhtml invalid.

 

Maybe you could incorporate this into the next release?

 

Will definitely consider that. I genuinely don't really understand all this w3c etc. complience stuff. I'm sure there is a good reason for it, so can somebody let me know this please.

 

 

When the ENCRYPTION was turned on when IM was first activated,

it seemed to load images faster and most of them.

It took about an hour before most images were loaded.

 

Yes, there is definitely something to this encrytion on/off thing. When I get a full weekend to myself (after the christmas exams), I will give i/m an overhaul based on all of the comments posted here.

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Vlad,

If imagemagic.php is not appearing in the url of your images, then try reinstalling as this is most often the problem - specifically the code into the catalog/includes/functions/html_output.php file. Make sure that you did not install it admin side.

Hi, Tom!

Thank you for replay.

The code into the catalog/includes/functions/html_output.php file - that's right. It's not in admin side.

Note 1: In the instructions below, I have made the assumption that your store's root folder is catalog. IE. Your store is accessed by typing www.yourstore.com/catalog into a browser.

My store is installed in root directory, not in catalog www.yourstore.com

imagemagic.php is appearing in the url of images of the Languages, It means that the cache is working - Is it true?

Link to comment
Share on other sites

I have now answered this countless times and it is also in the readme. The solution is to create a folder called thumbnails in your store's root folder (catalog in your case) and chmod it to 777

 

Tom

Just wanted to let you know that the readme file states "(the default is /thumbnail)" when it should actually read "(the default is /thumbnails)".

Link to comment
Share on other sites

Hi, I've just added this contribute to my site which I'm building locally on WAMP 5.1. I've been right through this message board and tried almost everything. The image holders are resizing so I'm assuming IM is working, I'm just getting broken links. The URL in properties is pointing in the right place, can anyone suggest whats wrong or help?

Link to comment
Share on other sites

Hi, I've just added this contribute to my site which I'm building locally on WAMP 5.1. I've been right through this message board and tried almost everything. The image holders are resizing so I'm assuming IM is working, I'm just getting broken links. The URL in properties is pointing in the right place, can anyone suggest whats wrong or help?

 

Are they broken or just missing, whats the error msg you get when trying to display an image directly on browser?

 

Start checking your apache logs for 'telling' error messages... Do you have permisions to view images?

Link to comment
Share on other sites

Hi, I've just added this contribute to my site which I'm building locally on WAMP 5.1. I've been right through this message board and tried almost everything. The image holders are resizing so I'm assuming IM is working, I'm just getting broken links. The URL in properties is pointing in the right place, can anyone suggest whats wrong or help?

 

There was a few message back at the start about getting i/m to work with windows.

I installed it myself on windows, and all I had to do was manually create the thumbnails directory and assign it the right permissions.

 

If anyone is having problems with image magic, the easiest was to diagnose the fault is

 

1. In your browser, right click on one of your product images, choose properties then check if 'imagemagic.php' is in the url. If not, then chances are the install went wrong. Can't think of any other reason.

 

2. If the image is broken and imagemagic.php is there, try manually creating a directory called thumbnails in your store's root folder, chmod this to 777 and then reload the page - Voila????

 

3. If not, then right click a product image in browser, select properties, copy the full url to your clipboard. Now paste this directly into the browser's address bar. If php error messages are switched on you may see an error message which will help you diagnose the problem.

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Hi, I've just added this contribute to my site which I'm building locally on WAMP 5.1. I've been right through this message board and tried almost everything. The image holders are resizing so I'm assuming IM is working, I'm just getting broken links. The URL in properties is pointing in the right place, can anyone suggest whats wrong or help?

 

Have you tried the above? If so, pm or post your url and I will take a look

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Tom,

 

Been working fine but just added specials for the launch of my site.

 

If a person clicks on a special image magic brings up the large pic in the right column box too along with the large pic for the product info page.

 

Only happens when a special is chosen, not anything else.

 

Checked the view source of both chioces.

 

with Special

<img src="imagemagic.php?img=images/bs0012.jpg&w=395&h=300&page=prod_info" width="395" height="300" border="0" alt="Beach Glass Nuggets II" title="Beach Glass Nuggets II">

 

without special

<img src="imagemagic.php?img=images/co008.jpg&w=139&h=115&page=" width="139" height="115" border="0" alt="Confetti" title="Confetti">

 

How, Where to I fix this?

my site is

www.fire-n-sand.com

Link to comment
Share on other sites

Here's the box code for specials

Not really sure this a IM problem but wouldn't the fix be to add code for something other than just the $random_product?

I don't know know how to do that myself.

 

 <?php
/*
 $Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<!-- specials //-->
	  <tr>
		<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);

new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>');

new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- specials_eof //-->
<?php
 }
?>

Link to comment
Share on other sites

Karen,

 

Yes, this problem would be specific to you, nevertheless, I do see what it is

 

Here are the mods you need to do:

 

in /catalog/product_info.php

 

Find this line:

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

change to:

document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"',true) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

in your modified tep_image() function in /includes/function/html_output.php

 

find this line (1st line of function):

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

 

and change to:

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

 

Now find this (about 10 lines into the function):

	  
&& $src == DIR_WS_IMAGES . $product_info['products_image']

 

and change to:

&& $src == DIR_WS_IMAGES . $product_info['products_image'] && main==true

 

Should work. Let me know

Tom

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Hi Tom,

 

First thanks for the outstanding contribution. The install directions were flawless, and almost everything is working as advertised.

 

The one issue I am running into is when I try to change the watermark text font from admin, there are no fonts displayed in the drop down list.

 

I double checked to make sure that I copied the fonts you supplied into the correct directory structure and they are there, but they don't display in the drop down.

 

Thanks again for the great contribution, and for any help you might be able to provide.

Link to comment
Share on other sites

Tom,

 

It doesn't seem to do this all the time since I reloaded the file for the specials box.

Don't bother spending anytime on this one.

 

Thanks again for your work on this con.

Karen :D

 

 

NOW YOU TELL ME!!!! :D

 

Anyway, apply the fix as I have looked at the code for the specials box and it WILL do this everytime the specials box comes up with a product which happens to be the one currently being displayed. The less specials you have the more frequent this will occur.

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Hi Tom,

 

First thanks for the outstanding contribution. The install directions were flawless, and almost everything is working as advertised.

 

The one issue I am running into is when I try to change the watermark text font from admin, there are no fonts displayed in the drop down list.

 

I double checked to make sure that I copied the fonts you supplied into the correct directory structure and they are there, but they don't display in the drop down.

 

Thanks again for the great contribution, and for any help you might be able to provide.

 

What about the watermark images, do they show up in the drop down list?

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Tom the html output gave me this error

 

Parse error: parse error, unexpected T_STRING, expecting '&' or T_VARIABLE or T_CONST in /mnt/web_e/d43/s16/b026482a/www/catalog/includes/functions/html_output.php on line 76

 

I went back to the orriginal for now but kept the change in the product info since that didn't error.

 

Out of 10 x it only came up with the big pic twice.

 

Karen

Link to comment
Share on other sites

I went back to the orriginal for now but kept the change in the product info since that didn't error.

 

OK, I think you did something wrong, like left out the final space, so here is the entire if block replacement about 4 lines into the tep_image() function

 

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";

}

}

 

Out of 10 x it only came up with the big pic twice.

 

Which statistically speaking, means you have about 5 specials...right?

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Tom it is this code that errors now

 

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

 

This is the my origianl

// BOF Image Magic 
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {  
global $product_info;

 

Thanks

karen

Link to comment
Share on other sites

lol, 6 actually.

 

Seems to work fine, doesn't even flinch no matter how fast I click thru the specials box.

 

Thanks!

Karen

 

put a curly bracket after the line

 

 

it should be:

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

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

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