Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Product Images with Relative Links

Product Images with Relative Links

Views: 764

Results 1 to 3 of 3
29 Mar 2011, 3:23 PM
#1
mattgoldfarb avatar

mattgoldfarb

New Zenner

Join Date:
Mar 2011
Posts:
3
Plugin Contributions:
0

Product Images with Relative Links

I am trying to get ZenCart to recognize product images that are stored in the DB instead of locally in the images folder.

I have an htaccess that redirects /image/# links to an image script that reads from the db and I tried to get the .htaccess to recognize /cart/images/(\d+) links to read from the db while reading all other images from the folder again so that I don't break the cart.

Problem is, nothing breaks but nothing works, it's like nothing is being registered at all and I am stuck in my development.

This is my first time posting on the ZenCart forums, so forgive me if I did not include enough information. I am running ZenCart v1.3.9h

Any ideas would be very appreciated.

Thanks.

30 Mar 2011, 9:52 PM
#2
g1smd avatar

g1smd

Zen Follower

Join Date:
Mar 2010
Location:
UK
Posts:
449
Plugin Contributions:
0

Re: Product Images with Relative Links

You should not externally redirect requests to an image script, you should instead internally rewite those requests.

What code have you tried so far?

The position of the code in the .htaccess file will also have a bearing on whether the code ever gets to be invoked.

Online since 1995.

30 Mar 2011, 11:47 PM
#3
mattgoldfarb avatar

mattgoldfarb

New Zenner

Join Date:
Mar 2011
Posts:
3
Plugin Contributions:
0

Re: Product Images with Relative Links

The following is the images folder .htaccess with my added code in bold.

Mind you this is the last of what I had tried. I also tried catching all requests to the /cart/images folder in my main .htaccess with this.

RewriteRule ^/cart/images/(\d+)/?$ /_ws/image.php?id=$1 [L,QSA]

Neither this change nor the change to the images .htaccess invoked anything.

Matt

#
# @copyright Copyright 2003-2010 Zen Cart Development Team
# @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
# @version $Id: .htaccess 16111 2010-04-29 22:39:02Z drbyte $
#
# This is used with Apache WebServers
#
# The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
# It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
# Will also prevent people from seeing what is in the dir. and any sub-directories
#
# For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
# Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified. 
# Example:
#<Directory "/usr/local/apache/htdocs">
#  AllowOverride Limit Options Indexes
#</Directory>
###############################

[B]<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteRule ^images/(\d+)/?$ /_ws/image.php?id=$1 [L,QSA]

</IfModule>[/B]

# deny *everything*
<FilesMatch ".*">
  Order Allow,Deny
  Deny from all
</FilesMatch>

# but now allow just *certain* necessary files:
<FilesMatch ".*\.(jpe?g|JPE?G|gif|GIF|png|PNG|swf|SWF)$" >
  Order Allow,Deny
  Allow from all
</FilesMatch>

IndexIgnore */*

## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
# OPTIONS -Indexes -ExecCGI