Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sign in to follow this  
tomjmul

Support thread for the Image Magic contribution

Recommended Posts

Hi, Tom! Glad to see youre back!

Your contrib is work fine on my site, but I have one question.

Animated gifs are not working the image magic is ON and I understand why. What could be done to make the animated gifs are working?

(Sorry for my english)

 

Regards,

Vlad

Edited by Scully

Share this post


Link to post
Share on other sites
Hi, Tom! Glad to see youre back!

Your contrib is work fine on my site, but I have one question.

Animated gifs are not working the image magic is ON and I understand why. What could be done to make the animated gifs are working?

(Sorry for my english)

 

Regards,

Vlad

 

 

Hi Vlad,

 

Hmm, that would be a problem. I'll look into some animated gif detection code. Meanwhile if you stumble across any, it would go into the i/m part of html_output and just set the calculate variable to false.

 

Tom


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

Tom,

For the time being I'm not using the animated gifs for that reason - so it not critical now.

But I do intend to do so as soon as it is functional.

 

Thanks

Vlad

Edited by Scully

Share this post


Link to post
Share on other sites

Hi I have installed this contribution but I cant get the water marks to work. When I click on choose graphic image there is nothing to pick from. Even though ther are the defauly images plus one I have uploaded in the folder 'watermarks'. I have set 'yes' to pop mup images, this would be when a larger image pop up window appears right?

 

Thanks

Chris

Share this post


Link to post
Share on other sites
Guest

MarkM you shouldn't need to change anything in the configure.php file. There is a missing '/' in the catalog/imagemagic.php in line 271

This:

	 if ($image_watermark) watermark_image(&$tmp_img, DIR_FS_CATALOG.'includes/imagemagic/watermarks/'.WATERMARK_IMAGE ,WATERMARK_IMAGE_POSITION, WATERMARK_IMAGE_OPACITY, WATERMARK_IMAGE_MARGIN);

 

Should be this:

	  if ($image_watermark) watermark_image(&$tmp_img, DIR_FS_CATALOG.'/includes/imagemagic/watermarks/'.WATERMARK_IMAGE ,WATERMARK_IMAGE_POSITION, WATERMARK_IMAGE_OPACITY, WATERMARK_IMAGE_MARGIN);

This is one of the reasons to graphic watermark wasn't working. I also had my PHP version upgraded on my server from 4.3.11 to 4.4.2

You should get your PHP upgraded if you have this option anyway as it addresses some security flaws and a couple of bugs.

 

Also, make sure you have a catalog/thumbnails folder on the server and CHMOD 777 or cacheing will results broken (missing) images. This contri is programmed to make this folder on demand however on some servers like mine it doesn't work and needs to be added manually.

 

And, WELCOME BACK! Tom! I thought we lost you.

Edited by HallMarc

Share this post


Link to post
Share on other sites

yes...success again,

now my site image is watermark for non members only...when members logon, watermark dissapear.

 

tom...thx for the great contribution. it really helps me alot, especially in time savings..

 

for those who are still working on it...keep trying, follow the readme given properly and i can guarantee you will get it. post the question up and i will try my best to solve as i did it to my site..

 

nice~~

Share this post


Link to post
Share on other sites
yes...success again,

now my site image is watermark for non members only...when members logon, watermark dissapear.

 

tom...thx for the great contribution. it really helps me alot, especially in time savings..

 

for those who are still working on it...keep trying, follow the readme given properly and i can guarantee you will get it. post the question up and i will try my best to solve as i did it to my site..

 

nice~~

 

e_piz,

That's a good idea for a feature in the next version, never thought of that!

Why don't you post the mod code here for people to use in the meantime.

Also, I'm sure those struggling to get i/m working will appreciate your offer of help here

Tom


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

Hallmarc, I think the issue you mentioned regarding the cache folder has been the single issue with which people have had most difficulty. The readme does address it, but it seems that most people don't actually bother with readmes - maybe I should rename that file please_please_please_readme :-)


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites
e_piz,

That's a good idea for a feature in the next version, never thought of that!

Why don't you post the mod code here for people to use in the meantime.

Also, I'm sure those struggling to get i/m working will appreciate your offer of help here

Tom

 

 

it's totaly simple to make it watermark for non members only...

 

open file catalog/includes/functions/html_output.php

 

original coding that is given in readme...

 

// BOF Image Magic

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

global $product_info;

 

//Allow for a new intermediate sized thumbnail size to be set

//without any changes having to be made to the product_info page itself.

//(see the lengths I go to to make your life easier :-)

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

 

if (isset($product_info['products_image'])

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

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

}

}

 

//Detect whether this is a pop-up image

if (strstr($_SERVER['PHP_SELF'],"popup_image.php")) $page="popup";

 

//do we apply the IE PNG alpha transparency fix?

if (strstr(strtolower($src),".png") && CFG_PNG_BUG=="True") $fix_png = true;

 

//send the image for processing unless told otherwise

$image = '<img src="' . $src . '"'; //set up the image tag just in case we don't want to process

 

 

if (CFG_MASTER_SWITCH=="On") $calculate = true;

else $calculate=false;

 

// Don't calculate if the image is set to a "%" width

if (strstr($width,'%') == true || strstr($height,'%') == true) $calculate = false;

 

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)

if (strstr($image, 'pixel')) $calculate = false;

 

 

$image_size = @getimagesize($src);

 

 

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

}

 

// Is this image good to go?

if (CONFIG_CALCULATE_IMAGE_SIZE && $calculate) {

 

if ($image_size) {

 

$ratio = $image_size[1] / $image_size[0];

 

// 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];

}

 

//Encrypt the image filename if switched on

if (CFG_ENCRYPT_FILENAMES == "True" && CFG_ENCRYPTION_KEY !="") {

$result = '';

$key=CFG_ENCRYPTION_KEY;

for($i=0; $i<strlen($src); $i++) {

$char = substr($src, $i, 1);

$keychar = substr($key, ($i % strlen($key))-1, 1);

$char = chr(ord($char)+ord($keychar));

$result.=$char;

}

$src=urlencode(base64_encode($result));

}

 

//Return the html

$image = '<img src="imagemagic.php?img='.$src.'&w='.

tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

 

} elseif (IMAGE_REQUIRED == 'false') {

return '';

}

}

 

//If the size asked for is greater than the image itself, we check the configs to see if this is allowed and if not over-ride

if ($width > $image_size[0] || $height > $image_size[1]) {

if (CFG_ALLOW_LARGER != 'True'){

$width=$image_size[0];

$height=$image_size[1];

$over_ride = true;

}

}

// Add remaining image parameters if they exist

if ($width) {

$image .= ' width="' . tep_output_string($width) . '"';

}

 

if ($height) {

$image .= ' height="' . tep_output_string($height) . '"';

}

 

if (tep_not_null($params)) $image .= ' ' . $params;

 

$image .= ' border="0" alt="' . tep_output_string($alt) . '"';

 

if (tep_not_null($alt)) {

$image .= ' title="' . tep_output_string($alt) . '"';

}

 

if ($fix_png && CFG_MASTER_SWITCH=="On") {

$image .= ' onload="fixPNG(this)"';

}

 

$image .= '>';

return $image;

}

//EOF Image Magic

 

 

 

the one in red colour I highlight above, replace with this code:

 

if (!tep_session_is_registered('customer_id') && CFG_MASTER_SWITCH=="On") $calculate = true;

else $calculate=false;

 

THAT'S ALL...AND NOW WATERMARKS ARE APPLIED NON MEMBERS ONLY.

 

 

p/s: maybe some of you are wondering, what are the difference making watermark for non members when they can register for free. let me tell you. in my site , before becoming a member, they need to be approve first. you can find contribution members approval at the contribution section.

 

THERE YOU GO..SIMPLE BUT EFFECTIVE.

Share this post


Link to post
Share on other sites

Welcome Back Tom..

 

Your contrib is awesome!

 

I think integrating support for multiple images will make it a complete/perfect image handling solution for Oscommerce.

Edited by mamram

Share this post


Link to post
Share on other sites

Yes indeed a simple and elegant mod. I will implement this in the next version, however might I suggest a slightly different implementation?

 

Rather than turning off all i/m functionality for registered customers, lets just switch off the watermarks. This is an equally quick and painless mod.

 

On around line 100 of imagemagic.php, just AFTER the switch block ending with:

 

case 5:

if (FRAME_POPUP=="Yes") $frame=true;

if (BEVEL_POPUP=="Yes") $bevel=true;

if (USE_WATERMARK_IMAGE_POPUP =="Yes") $image_watermark=true;

if (USE_WATERMARK_TEXT_POPUP =="Yes") $text_watermark=true;

$quality=(int)POPUP_JPEG_QUALITY;

break;

}

 

 

insert the following:

 

if (!tep_session_is_registered('customer_id') {

$image_watermark=false;

$text_watermark=false;

}

 

 

I think one of the big advantages of e_piz's idea is that your unwatermarked images will never show up on the google /msn etc. image search.

 

Tom


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

I've got it working, and everything looks awesome, but I cannot get the text watermark to work. The pictures show, but not the watermark (yes, I made sure I checked and refreshed pop-up jpegs). I only want the watermarks in my pop-ups, so I haven't tried them anywhere else. My store is in a sub-folder: www.subcultureofone.com/shop

Share this post


Link to post
Share on other sites

Hi Rachel,

 

Love the site!!!

 

The problem is that you are not using the standard popup_image.php script to handle your popup images.

I/m looks for this filename in the url in order to detect a pop up image and do its thing.

 

I'm not sure what you are using there, but it seems like some sort of custom html page for each popup.

 

The way around this is not at all straigtforward, so unless you wish to radically rethink your way of handling pop-ups, then unfortunately you won't be able to use any functions of i/m on these images

 

Tom


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

oops, the code for that no watermark for registered customer mod should be:

 

if (tep_session_is_registered('customer_id') {

$image_watermark=false;

$text_watermark=false;

}


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites

Hello everybody.

 

I've noticed a few people mentioning that they could not get the dropdown box for watermarks to work properly (just a blank dropdown). In my configuration, I was able to fix that by:

 

Open catalog/admin/includes/functions/general.php

 

Change DIR_FS_DOCUMENT_ROOT (2 instances)

To DIR_FS_CATALOG

 

So, that is fixed, but now all my images are broken links :rolleyes:

Share this post


Link to post
Share on other sites

Hi, I posted here yesterday but had no replies yet. I am using imagemagic, the watermarks are not working. When I go to 'edit' on the graphic water marks to pick a graphic, there is nothing in the drop down box!!

 

Does anyone have any ideas how I can get this to work?

 

 

Thanks

 

Chris

Share this post


Link to post
Share on other sites

If only I had read the other posts first...lol Sorr everyone. I just read the post above mine by olsonsp4c and its sorted now!!

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I installed im yesterday and nearly everything is ok. You did a realy good job.

 

The only problem I have is that *.png images don't work. jpg or gif sources are ok - pngs are not shown. php info says gd 2.0 or higher and png support enabled.

Are there any known hints so far?

 

Btw: this is a newbe question java script:emoticon(':rolleyes:', 'smid_15')

smilie

Share this post


Link to post
Share on other sites

Hi Right so I got all exciterd that the png image names were showing in the admin for watermarks, and I go to the store and it doesnt show anything... I have 'yes' for pop up and product thumbnail...

 

Does anyone know how to sort this as I am selling photography and really really need to secure the photographs on my site!!

 

Thanks

 

Chris

Share this post


Link to post
Share on other sites

Oh and also before having this installed I had my 'catagory' images set to 0 so you could see them (those annoying little crtoon things). But now they are back inforce...

 

How can I get rid of them?

 

Chris

Share this post


Link to post
Share on other sites
Oh and also before having this installed I had my 'catagory' images set to 0 so you could see them (those annoying little crtoon things). But now they are back inforce...

 

How can I get rid of them?

 

Chris

 

Hi Chris,

 

Can't thinks what might be the problem with the .PNG images, if you have any more info or want to provide a URL, I can take a look.

 

Regards the category images, try this fix:

 

In your control panel, set the width and height for category images to 0% rather than 0. i/m hates % signs and should then ignore these images.

 

Tom


OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Share this post


Link to post
Share on other sites
Guest

To all of those who are trying to get this contribution to work on the latest release of osCommerce, I don't know why but here is what I found. I have my own dedicated server that I lease from 'The Planet'. I just made a fresh install of osCommerce because I wanted to verify what I was seeing. In the catalog/includes/configure.php the full path for DIR_FS_CATALOG reads like this

 

define('DIR_FS_CATALOG', '/home/mysite/public_html/freshos');

 

Notice that the trailing slash is missing?

 

I checked the configure files with older clients and the trailing slash is there. This is what was causing problems in my installation of this contribution. Everything else, and I have many contributions installed, is working fine.

 

Check your configure.php file if you are having problems. For me adding the forward slash to the imagemagic.php to line 271 (right before the word includes )

 

And Tom, for you to post on the contribution page that my solution would break this contribution (THREE TIMES!??) was partially correct. It depends on which release you are adding this contribution to.

 

I, who have been coding for 4 years, took the time to find what was causing the problems. :-"

Share this post


Link to post
Share on other sites

Hi Tom. Thankyou for your reply. I tried your fix and it worked a treat!!!

 

As for the watermarks... the URL for my site is http://www.dream-store.co.uk/estore .

 

I have set yes to all the options and none of them have a watermark. I have set the watermark to a .png file. I have even tried using the text watermark to see if that will work but that doesnt either.

 

Thanks

 

Chris

Share this post


Link to post
Share on other sites
To all of those who are trying to get this contribution to work on the latest release of osCommerce, I don't know why but here is what I found. I have my own dedicated server that I lease from 'The Planet'. I just made a fresh install of osCommerce because I wanted to verify what I was seeing. In the catalog/includes/configure.php the full path for DIR_FS_CATALOG reads like this

 

define('DIR_FS_CATALOG', '/home/mysite/public_html/freshos');

 

Notice that the trailing slash is missing?

 

I checked the configure files with older clients and the trailing slash is there. This is what was causing

problems in my installation of this contribution. Everything else, and I have many contributions installed, is working fine.

 

Check your configure.php file if you are having problems. For me adding the forward slash to the imagemagic.php to line 271 (right before the word includes )

 

And Tom, for you to post on the contribution page that my solution would break this contribution (THREE TIMES!??) was partially correct. It depends on which release you are adding this contribution to.

 

I, who have been coding for 4 years, took the time to find what was causing the problems. :-"

 

 

Marc,

 

The 3 times thing was the site's fault, not mine. By giving no feedback as to the result of an upload and client caching a form post, it is asking for that and I do not apologize for the treble post. I have written an email to hpdl, but usually he coudn't give a sh1t about these things, so I don't expect either a reply or to have the other 2 removed.

 

Indeed while I am on the subject, the contribution methodology of osc is a mess and should have been changed a long time ago.

 

Regards your contribution, I do not apologize either for overwriting it or the words I used. If you have been coding for four years then you should have known that your post would have filled MY!!! p/m inbox within about a day.

 

All paths configured within configure.php should have a trailing slash - that is the standard and indeed the default. If you and others have installed host-provided osc and there is no trailing slash in the DIR_FS_CATALOG definition then the solution is to add one or modify the scripts to your own liking.

 

The solution is NOT to modify it so that it will work for you and a minority or others and then make a contribution telling EVERYONE there is a typo in my code which requires patching.

 

In the next version I will make sure that i/m works regardless, but for this version that is just the way it is.

 

Nevertheless, having said all of that, I know that your intentions were perfectly decent and in some ways it is a credit to you for helping out.

 

Maybe reading this thread can give a skewed perception of i/m's robustness. I would think that the vast majority of people using this contribution have no problems whatsoever or when they do, they actually bother to read the readme for guidance. Thus, generally they will never appear here.

 

This script will suffer more than others from the different possible set-ups out there mainly because:

1. It uses the server filesystem with all the different php, server OSes and permissions quirks that entails.

2. It uses version specific GD.

 

Again, that's just the way it is, and so be it.

 

If anyone does want to contribute to making i/m better and more robust, then what is required is an FAQ compiled from this thread, added to the readme and reuploaded. If you Marc, or anyone else is up for it let me know and I will help all I can.

 

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

You are a little dictator... The people only want to help to your contribution in http://www.oscommerce.com/community/contri...arch,thumbnails and the only thing you do is to ignore their help saying "Please ignore the post directly below which would break this script."

 

The possibility of upload a new version for anybody is for all the contributions. You are NOT special.

 

For example, I need your contrib, but as you are so selfish, I'll search for other contrib that make the same as yours.

Edited by Phosky

Forums, the perfect place to practice my English. From Spain.

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  

×