Click to See Complete Forum and Search --> : Re-size images?
Makaveli.2003
02-05-2003, 05:10 AM
Hi, is there away of adding code to a script that will resize images to a default size, so all the images used in the script are the same size, rather than me having to resize them all b4 uploading them? Iv attached my script below, can ne1 help??
khalidali63
02-05-2003, 05:14 AM
yes
set default size for ur images
imgW = 200;
imgH = 100;
now once you create an image object
var img = new Image();
img.src = "anyImage.gif";
at this point you can set its width and height
img.width = imgW;
img.height = imgH;
cheers
Khalid
Makaveli.2003
02-05-2003, 05:46 AM
Sorry, where exactly would I put those parts in my script? :confused:
khalidali63
02-05-2003, 05:52 AM
Hold on..let me take a look at ur script
khalidali63
02-05-2003, 05:59 AM
Here this is one example you will have to do it for all of the image arrays.
Suppose that you want all images to be a 24 X 24 size,Declare variables right after the script tags
<script type="text/javascript">
var imgW = 24;
var imgH = 24;
just like above.
then add the size and width in all the image arrays e.g
imglist[2] = new BuildZeroArray(ImagesInList[2])
imglist[2][0] = new Image ()
imglist[2][0].src = "subscrib.gif";
imglist[2][0].width = imgW;
imglist[2][0].height = imgH;
cheers
Khalid
Makaveli.2003
02-05-2003, 09:36 AM
Originally posted by khalidali63
Here this is one example you will have to do it for all of the image arrays.
Suppose that you want all images to be a 24 X 24 size,Declare variables right after the script tags
<script type="text/javascript">
var imgW = 24;
var imgH = 24;
just like above.
then add the size and width in all the image arrays e.g
imglist[2] = new BuildZeroArray(ImagesInList[2])
imglist[2][0] = new Image ()
imglist[2][0].src = "subscrib.gif";
imglist[2][0].width = imgW;
imglist[2][0].height = imgH;
cheers
Khalid
I cant seem to get it to work at all, ive added the to the top drop down menu (cpu) on the first 2 options, if u want to try put ur own .gif file in and try it, coz i cant seem to get it to work, may be I havnt put the code in teh right places, could you have a quick look and tell me where im goin wrong, please?
Makaveli.2003
02-05-2003, 09:38 AM
heres the file:
khalidali63
02-05-2003, 10:15 AM
email me few images and there appropriate array index.(where they should be in ur page)
k_ali@shaw.ca