zhanjh / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Controller for handling image sources #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Created the attached file to allow dynamic caching of images with the 
minify tool.  Not fully integrated but may assist someone. Uses i rather 
than f for a Get argument. (/min/?f=image/abc.js -> /min/?f=image/abc.gif).

Add the attached file as imageprocess_clean.php to the min folder and :

This code needs to be added to index.php after definition of 
MINIFY_MIN_DIR: 
 define('MINIFY_MIN_DIR', dirname(__FILE__));

 // Code added to cache images
if (isset($_GET['i'])) {
    require MINIFY_MIN_DIR . '/imageprocess.php';
    exit(0);
}
 // end Code added to cache images

Original issue reported on code.google.com by daba...@gmail.com on 25 Mar 2010 at 9:41

Attachments:

GoogleCodeExporter commented 9 years ago
The cache system can already cache binary content. All the logic in your 
attached
file could be placed in a custom Minify_Controller. The controller would 
validate the
request (which extensions are allowed), find the files, and register minifiers 
by
MIME type. Then you'd make a minifier that would, e.g., return the bytes of a
thumbnail image.

Minify doesn't send a Content-Transfer-Encoding header, but I doubt this is
necessary. For images you'd be wise to disable encoding since gzip would just 
add
processing overhead for the client.

Such a controller/minifier combo would be a neat API demo, but I don't have the 
time
to take this on, and it shouldn't be in the default min application.

Original comment by mrclay....@gmail.com on 26 Mar 2010 at 2:33