Jump to content

adaptive images


sean1688

Recommended Posts

we have some big images that goes outside of most mobile screens.

 

I have came across some work by Mat Wilcox.

 

have anyone implemented this on Cubecart?

 

below are the instructions, and they seem simple enough, but I am afraid to try it.

 

in particular, I have a question: 

the instructions says " It MUST go in the head as the first bit of JS, before any other JS."

 

so where do I place this piece of code?

 

at the index.php file?

Basic instructions

Copy adaptive-images.php and .htaccess into the root directory of your site. If you already have a htaccess file DO NOT OVERWRITE IT, skip down to the advanced instructions.

Copy the following Javascript into the <head> of your site. It MUST go in the head as the first bit of JS, before any other JS. This is because it needs to work as soon as possible, any delay wil have adverse effects.

<script>document.cookie='resolution='+Math.max(screen.width,screen.height)+'; path=/';</script>

That's it, you're done. You should proberbly configure some preferences though.

Link to comment
Share on other sites

CC5 uses two skins: the main skin (probably Kurouto) when not using a mobile device, and the Mobile skin, when is using a mobile device.

 

So, if the task is to get this javascript installed because images are too big for mobile devices, we must edit the Mobile skin template, main.php.

 

I would recommend adding the line of code just above:

<meta http-equiv="Content-Type" content="text/html;charset={$CHARACTER_SET}" />
Link to comment
Share on other sites

Try adding the following to your mobile css file

 

.sliderimg {

    border: none;

max-width: 100%;

display: block;

    margin: 0 auto;

}

 

Then give each image a class="slideimg"

 

 

Thanks for your help! How do I give the image a class="slideimg"?

 

also where do I put the code "<script>document.cookie='resolution='+Math.max(screen.width,screen.height)+'; path=/';</script>"?

 

CC5 uses two skins: the main skin (probably Kurouto) when not using a mobile device, and the Mobile skin, when is using a mobile device.

 

So, if the task is to get this javascript installed because images are too big for mobile devices, we must edit the Mobile skin template, main.php.

 

I would recommend adding the line of code just above:

<meta http-equiv="Content-Type" content="text/html;charset={$CHARACTER_SET}" />

 

 

thanks! do I also put the line <script>document.cookie='resolution='+Math.max(screen.width,screen.height)+'; path=/';</script> in this file as well?

Link to comment
Share on other sites

You are basically looking at two different solutions here. bsmither has a lot more experience than I do so maybe his solution is the one to try first.

 

I have used the css method which works fine for me but that is simply because I didn't know of a better way to do it.

 

So if you do try the css method then you need to add the class to your image file code e.g. <img src="myimagefilelocation.jpg" class="slideimg" alt="Description" /> in your mobile skin code where the relevant images appear.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...