[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path Zen Cart 源代码 image_handler.php
if (!file_exists( $filename )) {
return "no info";
}
$str = "";
// find out some details about the file
$image_size = @getimagesize($filename);
$image_fs_size = filesize($filename);
<script type="text/javascript">
<!--
function init()
{
cssjsmenu('navbar');
if (document.getElementById)
{
var kill = document.getElementById('hoverJS');
kill.disabled = true;
}
}
function popupWindow(url) {
window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=460,screenX=150,screenY=150,top=150,left=150')
}
<?php
// start of attributes display
if ($products_filter == '') {
?>
<h2><?php echo IH_HEADING_TITLE_PRODUCT_SELECT; ?></h2>
<?php
} else {
// Get the details for the product
$product = $db->Execute("select p.products_id, p.products_model,
p.products_image,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
pd.products_name,
p.master_categories_id
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . $_GET['products_filter'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
if ($product->RecordCount() > 0) {
$pInfo = new objectInfo($product->fields);
}
// Determine if there are any images and work out the file names
// (based on code from modules/pages/product_info/main_template_vars_images(& _additional) (copying is evil!))
if ($pInfo->products_image != '') {
// get file extension and base
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = preg_replace("/".$products_image_extension."$/", '', $products_image);
// if in a subdirectory
if (strrpos($products_image_base, '/')) {
$products_image_base = substr($products_image_base, strrpos($products_image_base, '/')+1);
}
// sort out directory
$products_image_directory = substr($products_image, 0, strrpos($products_image, '/'));
// add slash to base dir
if (($products_image_directory != '') && (!preg_match("|\/$|", $products_image_directory))) {
$products_image_directory .= '/';
}
$products_image_directory_full = DIR_FS_CATALOG . DIR_WS_IMAGES . $products_image_directory;
// Check that the image exists! (out of date Database)
if (file_exists( $products_image_directory_full . $products_image_base . $products_image_extension )) {
// Add base image to array
$products_image_match_array[] = $products_image_base . $products_image_extension;
// $products_image_base .= "_";
// check if this is a master image or if no images exist
if ($no_images) {
$contents[] = array('text' => '<strong>'.TEXT_INFO_IMAGE_BASE_NAME.'</strong><br />' );
$contents[] = array('text' => zen_draw_input_field('imgBase', '', 'size="30"'));
if ($page == 'about') {
?>
<div class="aboutbox">
<h2>Image Handler<sup>4</sup> v4.0 for v1.5.x</h2>
<p>
Image Handler<sup>4</sup> v4.0 for v1.5.x is based on an original contribution by Tim Kröger.<br /></p>
<fieldset>
<legend>Purpose & Aim</legend>
<p>Image Handler<sup>4</sup> at the heart of it's code is really meant to ease the management of product images (particularly the management of additional product images), and to help improve page performance by optimizing the product images.</p>
<p>Image Handler<sup>4</sup> generates product images (based on your image settings) in the Image Handler<sup>4</sup> CATALOG/bmz_cache folder. It <strong>DOES NOT</strong> replace or modify the original images. So it's PERFECTLY safe to use on an existing store.</p>
<p> Image Handler<sup>4</sup> enables you to use GD libraries or ImageMagick (if installed on your server) to generate and resize small, medium and large images on-the-fly/on page request. You can simply upload just one large image (that gets resized as required) or you can have different sources for medium and large images.<br />
Image Handler<sup>4</sup> also enables you to watermark your images on-the-fly (overlay a second specific translucent image onto the original) and have medium or large images pop up when you move your mouse over a small image (fancy hover).</p>
<p> This contribution includes a powerful admin interface to browse your products just like you would with the Attribute Manager and upload / delete / add additional images without having to do this manually via <acronym title="File Transfer Protocol">FTP</acronym>. Image Handler<sup>4</sup> works fine with mass update utilities like EzPopulate. </p>
</fieldset>
<hr>
<fieldset>
<legend>Features</legend>
<ul>
<li>Improves site performance (faster loading, faster display)</li>
<li>Professional looking images (no stair-effects, smooth edges)</li>
<li>Choose preferred image-types for each image size</li>
<li>Uploading one image automatically creates small, medium and large images on page request</li>
<li>Drops in and out seamlessly. No need to redo your images. All images are kept.</li>
<li>Easy install. One-click-database-upgrade.</li>
<li>Works with mass-update/-upload tools like EzPopulate.</li>
<li>Watermark images to prevent competitors from stealing them. (prove ownership)</li>
<li>Fancy image hover functionality lets a larger image pop up whenever you move your mouse above a small image (optional).</li>
<li>Choose an image background color to match your site or select a transparent background for your images.</li>
<li>Manage multiple images for products easily from one page just like you do with attributes in the Products Attribute Manager.</li>
</ul>
<p>Image Handler<sup>4</sup> is meant to ease the work required to setup images for your store. It works WITH default Zen Cart functionality, it does not replace it. </p>
<p>It is very strongly recommend you read through the ENTIRE "<strong>Configuration</strong>" & "<strong>Usage</strong>" sections of the Image Handler<sup>4</sup> readme file. There you will find out exactly what <strong>Image Handler<sup>4</sup></strong> can do.</p>
</fieldset>
<hr>
<fieldset>
<legend>Troubleshooting Basics</legend>
<p>Make sure your custom template is active. (Admin > Tools > Template Selection)</p>
<p>Make sure Image Handler<sup>4</sup> is installed. <strong>Admin
> Tools > Image Handler<sup>4</sup> > Admin</strong>.
Set permissions in both your <strong>images</strong> and <strong>bmz_cache</strong> folders to 755 (eg: <strong>both </strong>of these folders need
to have the same permissions. For some webhosts you may have to set these permissions to 777).</p>
<p>If Image Handler<sup>4</sup> does not work or gives you errors:</p>
<ul>
<li>Make sure all files are in correct location</li>
<li>Make sure you uploaded ALL the Image Handler<sup>4</sup> files</li>
<li>Make sure the files are not corrupt from bad FTP transfers</li>
<li>Make sure your file merge edits are correct</li>
<li>MAKE SURE YOU RE-READ THE CONFIGURATION AND USAGE SECTIONS!!!</li>
<li>Make sure that there are no javascript conflicts (this last point has been largely addressed since Rev 7)</li>
<li>Make sure that your main product image files names DO NOT contain any special characters (<font>non-alphanumeric characters such as / \ :
! @ # $ % ^ < > , [ ] { } & * ( ) + = </font>). Always use proper filenaming practices when naming your images - See this document as a reference: <small><a href="http://www.records.ncdcr.gov/erecords/filenaming_20080508_final.pdf" target="_blank">http://www.records.ncdcr.gov/erecords/filenaming_20080508_final.pdf\</a></small></li>
</ul>
</fieldset>
<hr>
<fieldset>
<legend>Zen Cart and Image Management</legend>
<p>Image Handler<sup>4</sup> is meant to ease the work required to setup images for your store.. It works WITH default Zen Cart functionality, it does not replace it.. Here's some additional FAQs which discuss how product images work in Zen Cart.</p>
<ul>
<li><a href="http://tutorials.zen-cart.com/index.php?article=224" target="_blank">Image Preparation - How-to</a></li>
<li><a href="http://tutorials.zen-cart.com/index.php?article=30" target="_blank">My images are distorted/fuzzy/squished, help?</a><br>
</li>
</ul>
<p>Information on how Zen Cart identifies/manages additional product images can be found on these Zen Cart FAQs:</p>
<ul>
<li><a href="http://tutorials.zen-cart.com/index.php?article=315" target="_blank">Why am I seeing images for other products on my product pages?</a></li>
<li><a href="http://tutorials.zen-cart.com/index.php?article=58" target="_blank">How do I add multiple images to a product?</a></li>
<li><a href="http://tutorials.zen-cart.com/index.php?article=202" target="_blank">How do I add more than one image of a product? I want to have a main image and also one or two other images that show more parts of a particular product. How/where do I add additional images to a product page? Thanks!</a></li>
</ul>
<p>Check out these FAQs and see if they help clarify how Zen Cart works with product images.</p>
</fieldset>
<hr>
<fieldset>
<legend> Prepare Your Site for Growth</legend>
<p>Not many users are aware that Image Handler<sup>4</sup> can manage the needs of a very large site as easily as it does a small one. When first building a site, the owner of a small site needs only to load images to the images folder. But when the site gets bigger and images multiply like rabbits, this can cause file naming confusions for Zen Cart and slow down the site. Preparing for your business to grow from the beginning will save you hours of work later on!</p>
<p>Without Image Handler<sup>4</sup> installed, Zen Cart requires you to create, optimize, and upload three different size images for each image you want to use. You must name these images using naming suffixes, and place them in corresponding folders inside your main image folder. For example: A product called "Widget" requires images/widget.jpg (small image) images/medium/widget_MED.jpg (medium image) and images/large/widget_LRG.jpg. This is such a hassle, especially if many of your products have multiple images. And as your site grows, it becomes an impossible task!</p>
<p>With Image Handler<sup>4</sup>, you no longer have to make three sizes of the same images and place them in different folders (unless you want to)! Instead, you need upload only one image in one folder and Image Handler<sup>4</sup> will do the rest! Simply upload your largest highest quality image and Image Handler<sup>4</sup> will resize and optimize your image as needed, and serve up small, medium, or large image sizes appropriate to the page loaded - all automatically and all without actually modifying your original image file in any way! Check out the Configuration Tab of this ReadMe for more info about this awesome functionality!</p>
<p>Prepare your site for growth by simply creating sub-folders in your main images folder. For example, you may want to put all your "widget" images in a folder called "widgets" and all your doodad images in a folder called "doodads" , like this:<br>
</p>
<p>Product: Blue Widget with 3 images<br>
---------------------------------- <br>
/images/widgets/blue_widget1.jpg (main product image for a blue widget, i.e. front view)<br>
/images/widgets/blue_widget2.jpg (additional product image for a blue widget, i.e. side view)<br>
/images/widgets/blue_widget3.jpg (additional product image for a blue widget, i.e. rear view)</p>
<p> </p>
<p>Product: Red Widget with 1 image<br>
--------------------------------<br>
/images/widgets/red_widget.jpg (main product image for a red widget)</p>
<p> </p>
<p>Product: Gold Doodad with 2 images<br>
----------------------------------<br>
/images/doodads/gold_doodad1.jpg (main product image for a gold doodad, i.e. view from above)<br>
/images/doodads/gold_doodad2.jpg (additional product image for a gold doodad, i.e. view from side)</p>
<p> </p>
<p>Product: Silver Doodad with 3 images<br>
------------------------------------<br>
/images/doodads/silver_doodad1.jpg (main product image for a silver doodad, i.e. product)<br>
/images/doodads/silver_doodad2.jpg (additional product image for a silver doodad, i.e. product detail)<br>
/images/doodads/silver_doodad3.jpg (additional product image for a silver doodad, i.e. product's silver stamp)<br>
</p>
<p>Using Image Handler<sup>4</sup>, you can easily sort and manage thousands of images without confusion or hassle! When selecting the main image for a product in the Image Handler<sup>4</sup> interface, Image Handler<sup>4</sup> lets you pick the location for this image. This prompt disappears afterwards because Image Handler<sup>4</sup> knows that additional images need to be in the same folder as their main product image and handles that automatically!</p>
</fieldset>