Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-01-2003 20:12:44

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

display any image size

This little hack will do away with having to keep images to the sizes listed in admin image sizes. (you still want to keep them consistent)

You need the Image::Magick library available

category images

in ste_cat.pl at the top

put use Image::Magick;

find ste_cat_show_image

after:
if (($image_name ne "") && (-e "$server_media_path/images/category/$image_name")) {

put:

$image = Image::Magick->new;
$image->Read("$server_media_path/images/category/$image_name");
($width, $height) = $image->Get('width', 'height');

then replace the next line:

print "<IMG SRC="$images_path/category/$image_name" WIDTH="$store_cat_image_width" BORDER="0">";

with:
print "<IMG SRC="$images_path/product_detail/$image_name" width="$width" height="$height" BORDER="0">";



this technique will also work with product images in ste_prod.pl
ste_prod_show_image and ste_prod_show_image_detail you just have to make sure the paths are correct

now your images will have the height and width attributes added.

There may be a better way to get the actual image size...



- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#2 07-24-2003 22:51:07

EagleWolf
Member
From: Daytona Beach, FL
Registered: 07-27-2003
Posts: 979

Re: display any image size

Wayne I am trying to do this but I am getting this error:

Script Execution Error
The following error was just encountered:

Can't locate Image/Magick.pm in @INC (@INC contains: /home/clickca/public_html/cgi-bin/modules /usr/lib/perl5/5.6.1/i686-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i686-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl . /home/clickca/public_html/cgi-bin/dbi) at /home/clickca/public_html/cgi-bin/library/modules/ste_cat.pl line 5. BEGIN failed--compilation aborted at /home/clickca/public_html/cgi-bin/library/modules/ste_cat.pl line 5.




Thanks,
Chris
wwwsite_name_deleted.com
wwwequivity.com - e-Commerce Website hosting starting at $5.95/month


Chris
<a href='mailto:webmaster@equivity.com'>webmaster@equivity.com</a>
-

Offline

 

#3 07-25-2003 22:09:19

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

I suspect your host does not have image::magick installed.

Somewhere around here was a link to a helper script that will list the modules installed, paths etc.

You may be able to install in your web space.


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#4 07-26-2003 09:04:37

EagleWolf
Member
From: Daytona Beach, FL
Registered: 07-27-2003
Posts: 979

Re: display any image size

It is installed on the server, but I do not think I am calling the module, or pointing to it corectly

Thanks,
Chris
wwwsite_name_deleted.com
wwwequivity.com - e-Commerce Website hosting starting at $5.95/month


Chris
<a href='mailto:webmaster@equivity.com'>webmaster@equivity.com</a>
-

Offline

 

#5 07-30-2003 20:11:20

Guest
Guest

Re: display any image size

It must installed somewhere other than in the directores in the @INC path.

If you know where it is you can add to that path using

use lib '/path/to/wherever/it/is';

use Image::Magick;

 

#6 07-31-2003 19:24:15

EagleWolf
Member
From: Daytona Beach, FL
Registered: 07-27-2003
Posts: 979

Re: display any image size

Wayne,

I tried this and I did not get any error but none of the category pictures showed up, it was almost like it did not know what size to make them so it made them 0. Any ideas?


Thanks,
Chris
http://www.site_name_deleted.com
http://www.equivity.com - e-Commerce Website hosting starting at $5.95/month


Chris
<a href='mailto:webmaster@equivity.com'>webmaster@equivity.com</a>
-

Offline

 

#7 08-01-2003 06:49:48

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

<font size="1" color="#FF0000">LAST EDITED ON 08-01-03 AT 07:52 AM (EST) Wrong element was referenced</font><p>here is the whole routine for category image display
after my $image_name = shift; you could add print "$server_media_path/images/category/$image_name"; for debugging to see if it is looking in the right place.

#######################################################################
# Ste Cat Show Image                                                  #
#######################################################################

#wk

sub ste_cat_show_image {

&initialize_sub_add('ste_cat_show_image');

#########
######### This routine displays category images when available.
#########

my $image_name = shift;

if (-e "$server_media_path/images/category/$image_name") {

$image = Image::Magick->new;
$image->Read("$server_media_path/images/category/$image_name");
($width, $height) = $image->Get('width', 'height');

print "<IMG SRC="$images_path/category/$image_name" width="$width" height="$height" border="0">";

} else {

print "<IMG SRC="$images_path/category/none.gif" width="$store_cat_image_width" border="0">";

} ######### End of if statement.

&initialize_sub_remove('ste_cat_show_image');

} ######### End of subroutine.

ste_cat.txt

(CGIGET TYPE="SUB" VALUE="ste_exec_storehead")

(CGIGET TYPE="SUB" VALUE="ste_cat_desc")

<div align="center"><!-- #wk added to show image when category is displayed --><!-- #wk must point to correct directory category_imgsm or category_imglg-->
(CGIGET TYPE="SUB" VALUE="ste_cat_show_image" PARAMS="(CGIVAR)category_imgsm(/CGIVAR)")</div><br>

(CGIGET TYPE="SUB" VALUE="ste_cat_disp")

(CGIGET TYPE="SUB" VALUE="ste_prod_disp")

(CGIGET TYPE="SUB" VALUE="ste_cart_shop")

<!-- ste_cat.txt -->


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#8 08-01-2003 07:31:27

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

also

my Sub Category Listing Display Type is set to no image displayed.


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#9 09-24-2003 22:05:08

EagleWolf
Member
From: Daytona Beach, FL
Registered: 07-27-2003
Posts: 979

Re: display any image size

Wayne,

How can I set this up to use across all images in CCP, or at the very least all product and category images?


Chris
<a href='mailto:webmaster@equivity.com'>webmaster@equivity.com</a>
-

Offline

 

#10 09-24-2003 23:20:03

EagleWolf
Member
From: Daytona Beach, FL
Registered: 07-27-2003
Posts: 979

Re: display any image size

Wayne

I think, but not, if I got it working correctly. But is this supposed to resize any picture based on the values we set in the "Manager Image Settings" in CCP admin. If so, then mine still is not working, becuase I put a very large image in for a category and it is showing the full image, it is not reduced at all.

I really would like to get this thing working.


Chris
<a href='mailto:webmaster@equivity.com'>webmaster@equivity.com</a>
-

Offline

 

#11 09-25-2003 06:28:02

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

No, this displays the image at it's current size. It puts the actual image dimensions in the img tag overriding the global settings in ccp.

to use this for other images, you need to edit the image display routines for products, small product image and in ccp 5.1 the extra large product image.

The way it is done is similar.

image::magick is a very powerful module capable of image manipulation and creation I suggest you read 


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#12 10-05-2003 18:50:28

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

try using this for ste_cat.txt

Make a backup

(CGIGET TYPE="SUB" VALUE="ste_exec_storehead")

(CGIGET TYPE="SUB" VALUE="ste_cat_desc")

<div align="center"><!-- #wk added to show image when category is displayed --><!-- #wk must point to correct directory category_imgsm or category_imglg-->
(CGIGET TYPE="SUB" VALUE="ste_cat_show_image" PARAMS="(CGIVAR)category_imgsm(/CGIVAR)")</div><br>

(CGIGET TYPE="SUB" VALUE="ste_cat_disp")

(CGIGET TYPE="SUB" VALUE="ste_prod_disp")

(CGIGET TYPE="SUB" VALUE="ste_cart_shop")

<!-- ste_cat.txt -->


and


both use this hack


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#13 10-13-2003 14:03:23

ramayes
Member
From: Houston, Texas
Registered: 10-04-2003
Posts: 73
Website

Re: display any image size

I visited both these sites and was unable to locate and images with popup windows, I probably just didn't know which products are using popups.


and


can you let know which pages and which ites so I may check them out?


Anne Mayes

Offline

 

#14 10-20-2003 15:49:20

WayneK
Member
Registered: 08-17-2003
Posts: 256
Website

Re: display any image size

oops missed this


- Wayne
<-- Witty Clever Phrase Goes Here -->

Offline

 

#15 10-29-2004 23:16:25

hellraiser
Member
From: Vermont, USA
Registered: 08-12-2004
Posts: 58
Website

Re: display any image size

this is all great BUT

who knows how to install Image::Magick on a web server that i am renting space from.  i have it installed perfectly on my computer with apache2 for windows and the release of activestateperl.....but, who knows how to install the module on a web server if you dont have root access?????

Offline

 

#16 11-11-2004 16:32:31

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: display any image size

The person with root access would have to do it.  It's a compiled module.


Nick Hendler

Offline

 

#17 11-22-2004 08:55:47

dtwg
Member
From: California
Registered: 11-15-2004
Posts: 1339
Website

Re: display any image size

You might not necessarily need root privileges...

From the ImageMagick download page:

By default, make install
will install the package's files in `/usr/local/bin', `/usr/local/lib', etc.. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. This is valuable in case you don't have privileges to install under the default paths or if you want to install in the system directories instead.

Good Luck!

Offline

 

#18 11-24-2004 11:48:41

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: display any image size

Also, by slamming a module into a user directory and using the 'use lib' pragma in the Perl code, you may be able to get around the root requirement.  Ie:

usr lib "/path/to/user/dir";

use ImageMagick;

(Assuming ImageMagick is in /path/to/user/dir)


Nick Hendler

Offline

 

Board footer