My multiimage module presents random images from the database with a URL. For example, if you click this link, each time you refresh you will see a random image:
http://curttimmerman…ge&group_name=_DEMO
I have a request to add the capability to add external image links to this function. My question is: Can you redirect a browser request for an image? Are there any browser dependent implications of doing this?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 created topic »Pages 2.5.0 and updating - Page not found« 05:20 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 05:05 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
- frw responded to »Bug in the SMTP mail transfer protocol - Port 25 - Zikula 1.2.9« 22. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Redirecting a browser image request
-
- Rank: Softmore
- Registered: Feb 07, 2003
- Last visit: Jun 11, 2008
- Posts: 225
-
**unknown user**
- Rank: Helper
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 676
Can you redirect a browser request for an image? You're asking if the server can do this; Yes. On Apache, the mod_rewrite (URL rewriting) module can do this easily, with a simple rule put in an .htaccess file. On IIS servers, there are commercial versions of the same, but obviously doesn't come standard.
As if the module can do this in PHP, that depends on the module. If it works off a list of known images, it's a matter of using a full URL instead of a local file path. If it's just given a directory and told to display the contents randomly, then probably not, depends on your permissions for the remote server.
For instance, off the top of my head, an htaccess rule in the image dir using Apache mod_rewrite:
Rewrites someimage-ext.jpg toCode
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)-ext\.(jpe?g|gif|png)$ http://www.example.com/images/. [R]
http://www.example.com/images/someimage.jpg -
- Rank: Softmore
- Registered: Feb 07, 2003
- Last visit: Jun 11, 2008
- Posts: 225
Just to try to clarify what I am asking...
The link above would be contained in a IMG HTML tag. It doesn't point to an image but invokes a module function that actually returns the image data.
What if instead of returning the image, the function redirected the browser to a different link. Has anyone ever tried this?
Thanks in advance, -
**unknown user**
- Rank: Helper
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 676
Guess I can't help you much, I installed your module and put in a bunch of external image URLs, which it seems to handle just fine. I had the store in DB unchecked, so it should have gotten them externally.
I don't know why you'd want to redirect the browser. That would take you away from the site altogether. All you'd want to do is change the image source, which is not a redirect. Whatever the backend does, and wherever it sources the image, the browser doesn't care, as long as it's fed standard HTML and image data, which is what PHP does. Unless you're talking Javascript, I can see no browser issues. You can have an iFrame if that's what you mean, and point it at whatever you want. They're a window into another page or site. But not really suitable here, I should think.
- Moderated by:
- Support
