Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for JcM Adaptive Images Phoenix V1.0


JcMagpie

Recommended Posts

JcM Adaptive Images hook for Phoenix 1.0.2.x only.

Is now a hook. If you already have it installed just remove header files after uninstalling and add new files.

This addon uses the code by MattWilcox/Adaptive-Images from GitHub It is used as supplied and all credit is with original author.

All this add-on does is allow you to install in as a module you can turn on and off.

Adaptive Images by Matt Wilcox is licensed under a Creative Commons Attribution 3.0 Unported License. This will automatically produce several images from your original image so each device can be served with the correct size image. Will help speed up site loading on mobile devices.

Again totally stand alone with no core code change.

You will have nothing to see as it just adds script. Go to a mobile device and view your site, browse around and then check your site files. You should have a directory /ai-cache and within this will be other folders /100 /200 to match your image widths. If this is true its working. If not check your configuration.

The script works with good quality images! So if your images are small to begin with not much point using this. As it will scales up images to try and give a better view all you will get is a fuzzy mess!

 

You need to add this code to your .htaccess file. I strongly advise you to duplicate that file so you can revert to it if things go pear-shaped.

Open your existing .htaccess file and edit the contents. You'll need to look and see if there is a section that begins with the following:

 

<IfModule mod_rewrite.c>

If there is, then you need to add the following lines into that block:

# Adaptive-Images

-----------------------------------------------------------------------------------

# Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:

# RewriteCond %{REQUEST_URI} !some-directory

# RewriteCond %{REQUEST_URI} !another-directory

RewriteCond %{REQUEST_URI} !assets

# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above

directories

# to adaptive-images.php so we can select appropriately sized versions

RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php

# END Adaptive-Images

 

If you don't have a code block then simply copy and paste the

following into your file instead:

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

# Adaptive-Images

-----------------------------------------------------------------------------------

# Add any directories you wish to omit from the Adaptive-Images process on a new

line, as follows:

# RewriteCond %{REQUEST_URI} !some-directory

# RewriteCond %{REQUEST_URI} !another-directory

RewriteCond %{REQUEST_URI} !assets

# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above

directories

# to adaptive-images.php so we can select appropriately sized versions

RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php

# END Adaptive-Images

-------------------------------------------------------------------------------

</IfModule>

 

The “adaptive-images.php” file and has all the settings that are in the CONFIG area. By default it looks like this:

/* CONFIG

-----------------------------------------------------------------------------------

------------------------ */

$resolutions = array(1382, 992, 768,500, 480, 250, 200, 150, 100); // the

resolution break-points to use (screen widths, in pixels)

$cache_path = "ai-cache"; // where to store the generated re-sized images.

Specify from your document root!

$jpg_quality = 80; // the quality of any generated JPGs on a scale of 0 to 100

$sharpen = TRUE; // Shrinking images can blur details, perform a sharpen on

re-scaled images?

$watch_cache = TRUE; // check that the adapted image isn't stale (ensures updated

source images are re-cached)

$browser_cache = 60*60*24*7; // How long the BROWSER cache should last (seconds,

minutes, hours, days. 7days by default)

/* END CONFIG

-----------------------------------------------------------------------------------

-----------------------

------------------------ Don't edit anything after this line unless you know what

you're doing -------------------------

-----------------------------------------------------------------------------------

---------------------------------- */

You should not need to change any of these settings.

This addon uses the code by MattWilcox/Adaptive-Images from GitHub It is

used as supplied and all credit is with original author.

All this add-on does is allow you to install in as a module you can turn on and off.

image.png.68427560eb8ee1f5f16a378e97a3dc8f.png

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...