Zen Cart Logo
Forums / All Other Contributions/Addons / Image Handler 2 (for ZC v1.3.8 ONLY) Support

Image Handler 2 (for ZC v1.3.8 ONLY) Support

Views: 2,510,514

Results 641 to 660 of 7,094
12 Nov 2006, 11:02 PM
#641
dvasdekis avatar

dvasdekis

New Zenner

Join Date:
Nov 2006
Posts:
70
Plugin Contributions:
0

Image Handler 2 (for ZC v1.3.8 ONLY) Support

I'm having the same problem as alexblom, where all the images are being created as user apache and group apache, a non-existant user and group on my server. As a result of this, the premissions are restricted on the cache files, and Image Handler can't write to them or delete them once they have been written for the first time. This is causing all sorts of errors, with Image Handler recreating each cache image on every page view, with some images never showing up and other pages just refusing to parse.

My host is a quality one and has very low cpu/bandwidth use, so that isn't the issue.

Is there any way to force image handler to write with the correct user and group? We have that php extension installed that forces programs to write with the correct user and group, but Image Handler seems to make an exception to that.

Failing that, is there another mod with the 'automatically resize images' function? I can deal with one dependent on GD or ImageMagick.

Many thanks.

13 Nov 2006, 9:34 AM
#642
dvasdekis avatar

dvasdekis

New Zenner

Join Date:
Nov 2006
Posts:
70
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Also, forgot to mention that I'm runnning a Plesk control panel on CentOS.

13 Nov 2006, 12:14 PM
#643
heavenlynights avatar

heavenlynights

Zen Follower

Join Date:
Jan 2006
Location:
Australia
Posts:
303
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Hi everyone.

I have a problem with IH. I upgraded to 1.3.6, made sure all my permissions for images and bmz_cashe folders were correct and corresponding with each other and came up with this prob.

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/b/b86296bbaa236efe649500691a3135fc.image.44x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/4/418fead62bb78eb5521701c6c5c2a306.image.59x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/9/9eb10a9a007ca23ae7c90d6f7c652914.image.73x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/2/2b2762445b2407b8421481f8087b030b.image.40x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/b/b8f18a290f5f5e77c3920c3fabc5ec28.image.39x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/4/445e0202529f1d2529e686803b7c2989.image.53x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/f/f2a50cd8b3858f80b8b5762c4b4faa2d.image.50x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/2/2b0ca90e7ce5abba1b1d3d8cc51667a5.image.42x110.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/8/8920da66b7ba644bea2dc59db63ed24f.image.90x108.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/5/5be3bc43731790e42480ddf8cde1b2c9.image.90x72.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

Warning: imagejpeg(): Unable to open '/home/showgirl/public_html/bmz_cache/c/ce0bf956b8fcf753d7e6a5d2bbbb18f2.image.90x90.jpg' for writing in /home/showgirl/public_html/includes/classes/bmz_image_handler.class.php on line 652

so I unistalled, cleared cache then reinstalled and still have this problem.

The corresponding line these warnings refer too in the bmz_image_handler.class.php file is as below.

				$ok = imagejpeg($image, $dest_name, $quality);

BTW - I did notice this issue mentioned earlier in the thread, but this didn't help me in any way.

does anyone have any ideas on how to fix!!

TIA

13 Nov 2006, 7:50 PM
#644
polarduality avatar

polarduality

Zen Follower

Join Date:
Mar 2006
Location:
Los Angeles
Posts:
260
Plugin Contributions:
2

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

make sure you changed the file permissions on ALL the subdirectories inside the bmz_cache folder.

13 Nov 2006, 8:17 PM
#645
heavenlynights avatar

heavenlynights

Zen Follower

Join Date:
Jan 2006
Location:
Australia
Posts:
303
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

polarduality:

make sure you changed the file permissions on ALL the subdirectories inside the bmz_cache folder.

Thanks polarduality but did that prior to posting!!

13 Nov 2006, 8:28 PM
#646
steveorg avatar

steveorg

New Zenner

Join Date:
Oct 2006
Location:
The Wrong Coast
Posts:
22
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Image handler overwrites several ZC files. Is it okay to use the template override system instead? Thanks.

Steve

13 Nov 2006, 10:33 PM
#647
heavenlynights avatar

heavenlynights

Zen Follower

Join Date:
Jan 2006
Location:
Australia
Posts:
303
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

UPDATE:

ok, not sure why it happened in the first place, but after thinking about for a while, I managed to fix it.

THE FIX for anyone else who might come across this prob.

I decided to re-unistall IH2 and clear the cache. After I did this in the Zen admin, I then checked the bmz_cache folder on the server to make sure it was cleared and low and behold it was'nt. (not sure why this did not work when clearing IH cache in zen admin)

I then manually cleared each and every sub directory under the bmz_cache folder on my server.

I then went back into my admin >>> tools >>>> IH2 >>> admin and re-installed the IH.

Presto - PROBLEM FIXED :D

Hope this helps if anyone else has this problem, but before doing this fix, first check that your permissions in your images and bmz-cache folders are both set to 777 as you don't want to un-necessarily do this if your problem is that of inconsistant permissions.

14 Nov 2006, 1:06 AM
#648
crzipilot avatar

crzipilot

New Zenner

Join Date:
Oct 2006
Posts:
39
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Hmmm....tried that...still didn't work.....

14 Nov 2006, 4:51 PM
#649
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Hi There,

I have successfully installed IH2 and my sites looks much better for it in IE6 which doesn't handle client-side scaling at all well.

There are however a couple of things which I need to get working and any help/pointers would be great:

  1. Attribute images are still poor quality, client-side scalings not handled by IH2. Is this a problem with my install? Or has support for this not been developed?

If the case is the latter, then is there an easy way for me to call images using IH2 so that can have a go at making the changes myself? Or can anyone on the list recommend an alternative solution?

  1. I would also like to add some javascript to change the main product image each time an attribute option is selected or an attribute image is clicked.

Does anyone on the list have a script which can do this?

Thanks in advance

ColinR

14 Nov 2006, 5:04 PM
#650
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

IH2 handles ONLY product images.

There is a Swap Image on MouseOver mod by DrByte somewhere, but it isn't (as far as I know) compatible with IH2. However, it may give you some pointers ...and if you can come up with a working version with IH2 installed, that would be an extremely useful contribution to add to the community.

However, image swapping doesn't have to be javascript... take a look at http://www.cssplay.co.uk/menu/gallery.html (oh sorry - there goes the next couple of hours! :D ) where there's some great ideas. (How it's done is nearly always in his View Source)

14 Nov 2006, 10:12 PM
#651
polarduality avatar

polarduality

Zen Follower

Join Date:
Mar 2006
Location:
Los Angeles
Posts:
260
Plugin Contributions:
2

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

*bookmarks link :)

lot's of good stuff in there. :)

15 Nov 2006, 1:02 AM
#652
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Hi Ryk,

Thanks for the pointers. To keep things simple then, I have implemented a separate image popup for attribute images - which is probably more sensible than swapping the main product image.

I have used a free, third-party script to generate smoother attribute images on demand rather than trying to hack into IH2. I am however running this alongside IH2 (which naturally brings other benefits) without any problems.

Perhaps I need to package this up as a new contribution when it's tidied up?

To make this work you'll need this script in your root directory:

http://www.zubrag.com/scripts/thumbnail-generator.php

You then need to modify the bottom of file /includes/functions/html_output.php as follows:

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . zen_output_string($src) . '" alt="' . zen_output_string($alt) . '"';

if (zen_not_null($alt)) {
  $image .= ' title=" ' . zen_output_string($alt) . ' "';
}

if (zen_not_null($parameters)) $image .= ' ' . $parameters;

$image .= ' />';

return $image;

}

?>

...becomes...

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default

$image = '<img src="thumb.php?src=' . zen_output_string($src) . '&x=100&y=100&f=0" alt="' . zen_output_string($alt) . '"';

if (zen_not_null($alt)) {
  $image .= ' title=" ' . zen_output_string($alt) . ' "';
}

if (zen_not_null($parameters)) $image .= ' ' . $parameters;

$image .= ' onclick="popupWindow(\'http://YOURDOMAIN/index.php?main_page=popup_image&src='.zen_output_string($src).'\')"';

$image .= ' />';

return $image;

}

?>

Finally you need to modify the template which displays in the popup image window so that you can present any image you choose simply by providing the path in a new 'src' attribute:

/includes/templates/YOUR_TEMPLATES/popup_image/tpl_main_page.php

Change...

<?php // $products_values->fields['products_image'] echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>'; ?>

</div> ...to...

<?php if ($_GET['src']) { echo '<a href="javascript:window.close()"><img src="' . $_GET['src'] . '"></a>'; } else { // $products_values->fields['products_image'] echo '<a href="javascript:window.close()">' . zen_image($products_image_large, $products_values->fields['products_name'] . ' ' . TEXT_CLOSE_WINDOW) . '</a>'; } ?>

</div> This should now present any image you upload in the attributes controller as a server-side scaled image in your products pages and allow you to pop up the full size version in the standard popup image window.

Feel free to test and advise.

ColinR

15 Nov 2006, 2:53 AM
#653
chayton6 avatar

chayton6

New Zenner

Join Date:
Dec 2004
Location:
SC
Posts:
40
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

We have IH version 2.0 installed on a zencart version 1.3.6 - is there a sql patch required? The additional images are not showing on the category pages. I checked under admin/product types to edit those configs (to show additional images) and that's not even an option. I checked the sql tables, and the option isn't listed. I've searched other threads and can't seem to find an answer. If there is a sql patch required, where could I find it?

Thanks,
Danielle

15 Nov 2006, 7:49 AM
#654
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

@colinr - thanks; I'll give that a try later (hopefully!)

@chayton6 - did you install the latest version of IH2 from the download section AFTER 1.3.6? You do need to do it that way...there is a post by DrByte somewhere explaining about ereg replacement.

15 Nov 2006, 11:18 AM
#655
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

colinr - what version of ZC are you using? Your html_output doesn't match the 1.3.6 one...and there are two sections at about line 120 and about line 196 with similar code to above...neither of which is anywhere near the end of the file! :D

However, the second instance does have some effect, but not what I was hoping for! The main product image has disappeared and the attribute images now appear to be expanded thumbnails!!

OK, I'm going to start this again. :D

15 Nov 2006, 11:37 AM
#656
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Nope - can't get this to work; is it working for you colinr? Have carefully re-done the procedure you've outlined and the results are the same as I reported earlier.

15 Nov 2006, 3:21 PM
#657
chayton6 avatar

chayton6

New Zenner

Join Date:
Dec 2004
Location:
SC
Posts:
40
Plugin Contributions:
0

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

@chayton6 - did you install the latest version of IH2 from the download section AFTER 1.3.6? You do need to do it that way...there is a post by DrByte somewhere explaining about ereg replacement.[/QUOTE]

Yes, I read his posts. No, I did not install IH2 after the cart. Actually, I didn't do the installs at all. The store owner had the cart upgraded from a prev version to 1.3.6. I read the threads and he'd listed three pages that need to be used from the IH2 install (additional_images.php I believe and 2 others) and I uploaded those from the IH2 install. But that's not really addressing the fact that I don't have the option to set 'show additional images' to true - that option doesn't exist on my products types / edit layout page and isn't in my sql tables as an option. That's why I asked about the sql patch.

15 Nov 2006, 7:29 PM
#658
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Ryk:

Nope - can't get this to work; is it working for you colinr? Have carefully re-done the procedure you've outlined and the results are the same as I reported earlier.

Sorry about that. It definately works - but I think the 'original' code I sent through was actually a mod I had done previously and overlooked. Too many late nights. :blink:

I will check through my code when I get a chance and send amendments.

ColinR

15 Nov 2006, 10:36 PM
#659
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

colinr:

I will check through my code when I get a chance and send amendments.

Much appreciated - thank you.

15 Nov 2006, 10:50 PM
#660
colinr avatar

colinr

New Zenner

Join Date:
Jul 2006
Posts:
35
Plugin Contributions:
1

Re: Image Handler 2 (for ZC v1.3.8 ONLY) Support

Hi Ryk,

Further to my previous post I think I have got to the bottom of this.

When I first looked at this a couple of weeks back I duplicated the html image wrapper function 'zen_attribute_image' in /includes/functions/html_output.php and renamed the duplicate function 'zen_attribute_image' so that I could easily apply new code to attribute images only.

Here then is the complete zen_attribute_image function - including the pop-up code modifications I sent last night - which should simply be appended to /includes/functions/html_output.php.

/*

  • The HTML attribute image wrapper function
    */
    function zen_attribute_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
    global $template_dir;

    // soft clean the alt tag
    $alt = zen_clean_html($alt);

    // use old method on template images
    if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {
    return zen_image_OLD($src, $alt, $width, $height, $parameters);
    }

//auto replace with defined missing image
if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}

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

// if not in current template switch to template_default
if (!file_exists($src)) {
  $src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
}

// hook for handle_image() function such as Image Handler etc
if (function_exists('handle_image')) {
  $newimg = handle_image($src, $alt, $width, $height, $parameters);
  list($src, $alt, $width, $height, $parameters) = $newimg; 
}

// Convert width/height to int for proper validation.
// intval() used to support compatibility with plugins like image-handler
$width = empty($width) ? $width : intval($width);
$height = empty($height) ? $height : intval($height);

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default

$image = '<img src="thumb.php?src=' . zen_output_string($src) . '&x=100&y=41&f=0" alt="' . zen_output_string($alt) . '"';

if (zen_not_null($alt)) {
  $image .= ' title=" ' . zen_output_string($alt) . ' "';
}

if (zen_not_null($parameters)) $image .= ' ' . $parameters;

$image .= ' onclick="popupWindow(\'http://YOUR_DOMAIN/index.php?main_page=popup_image&src='.zen_output_string($src).'\')"';

$image .= ' />';

return $image;

}

?>

You then need to modify /includes/modules/attributes.php (or naturally a copy of this file at /includes/modules/YOUR_TEMPLATES/attributes.php) changing all occurances of...

zen_image(

...to..

zen_attribute_image(

...so that the new zen_attribute_image function is called rather than the generic zen_image function.

There may, of course, be a more elegant way to do this. Any suggestions are welcome.

ColinR