Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header image size script


firben

Recommended Posts

Hello,

I have edited my shop to have a huge header image, that i feel looks really nice!

The problem is that it only looks really nice on a big screen, so i was wandering wether someone has a script that changes the header image file depending on the screen resolution.

 

BRGS,

Steph

Link to comment
Share on other sites

I do not think that there is contribution to resize as needed a jpg file.The perfect option would be to create a box and put the jpg in that box, but osc do not allow you to put box in any other place that lef or right.I have my website centered with 800 that way do not change.Mybe someone know how to put a box in banner.

Link to comment
Share on other sites

Getting the screen size in PHP isn't possible (directly).

 

I found a script that does it in PHP, but it requires a cookie (set by a JavaScript routine) so it might not work in all cases (i.e. cookies are disabled).

 

Or you could just do the whole thing in JavaScript.

 

Tell me a little more about your needs and I'll try to "cook" something up for you if you like...

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Getting the screen size in PHP isn't possible (directly).

 

I found a script that does it in PHP, but it requires a cookie (set by a JavaScript routine) so it might not work in all cases (i.e. cookies are disabled).

 

Or you could just do the whole thing in JavaScript.

 

Tell me a little more about your needs and I'll try to "cook" something up for you if you like...

:unsure:

 

Hey Germ..

I have a shop on www.biitl-juze.com/shop

 

i have just changed the topgraphic to a smaler version because it was too big for laptops..

the thing is that when a user that has a laptop logs on, i want it to show the page as it is now.. but when the user uses a bigger screen, i want a much bigger image to show (eg. the one found here http://biitl-juze.com/shop/images/top.jpg)

 

would that be possible?

 

thanks in advance!

Link to comment
Share on other sites

MAKE A BACKUP BEFORER MAKING ANY EDITS!!!

 

In this file:

 

/shop/includes/header.php

 

Find this code:

 

	<td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'top2.jpg', 'top graphics for Biitl-Juze with fashion keyring green') . '</a>'; ?></td>

 

Replace it with this code:

 

<script LANGUAGE="JavaScript">

//JavaScript screen variables

//screen.width

//screen.height

//change 756 in next line to suit your taste

if ( screen.height < 756 ) {

//low res

document.write('<td valign="middle"><a href="http://biitl-juze.com/shop/index.php"><img src="images/top2.jpg" border="0" alt="top graphics for Biitl-Juze with fashion keyring green" title="top graphics for Biitl-Juze with fashion keyring green "></a></td>');

}

else {

//hi res

document.write('<td valign="middle"><a href="http://biitl-juze.com/shop/index.php"><img src="images/top.jpg" border="0" alt="top graphics for Biitl-Juze with fashion keyring green" title="top graphics for Biitl-Juze with fashion keyring green "></a></td>');

}

</script>

 

I'm not sure where you want the dividing line to be with respect to screen resolution.

 

The code has a comment about what to change.

 

I arbitrarily made the dividing line 756 (screen height). You can alter that number to suit your taste.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

MAKE A BACKUP BEFORER MAKING ANY EDITS!!!

 

In this file:

 

/shop/includes/header.php

 

Find this code:

 

	<td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'top2.jpg', 'top graphics for Biitl-Juze with fashion keyring green') . '</a>'; ?></td>

 

Replace it with this code:

I'm not sure where you want the dividing line to be with respect to screen resolution.

 

The code has a comment about what to change.

 

I arbitrarily made the dividing line 756 (screen height). You can alter that number to suit your taste.

 

hello!!

Thanks a mill!!!

it seeems to work like a charm! :-D

good work..

 

 

brgs,

Steph

Link to comment
Share on other sites

by the way...

can i use a simmilar method to adjust to the browser size instead of the screen size!? i mean.. if the user har his/her browser set to other than maximized..

i am not sure if i have expressed myself right here... :-S

'I've had a look at "window.screen.availHeight" but beeing wors at java than php it made very little sence..

Link to comment
Share on other sites

On pop-up windows you can set the window size, but if they just access your site by typing in http://biitl-juze.com in their browser address bar, you can't change the main window size (as far as I know).

 

If someone else who reads this has a way, POST IT!!!

:lol:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I lied...

:blush:

 

In the <head> section

 

<script>

function changeScreenSize(w,h)

{ window.resizeTo( w,h )

}

</script>

 

In the <body> tag

 

<body onload="changeScreenSize(500,300)">

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...