replace RewriteRule ^([^/\.]+)/([^/\\]+)$ index.php?album=$1&image=$2 [QSA,L] with RewriteRule ^([^/\.]+)/([^/\\]+)\.html$ index.php?album=$1&image=$2 [QSA,L] it change bmw.jpg to bmw.jpg.html but you can't change bmw.jpg to bmw.html, since php will not know it is a bmw.jpg or bmw.gif or .... Also, you have change all the functions which generate URLs in the template-functions.php
The problem is that the .jpg is actually part of the filename... it's there for a darn good reason. It would be much easier to add a /view.html or something *after* the filename.jpg, which is easily done in .htaccess alone.
I would not recommend changing the filename handling. It will run you into MANY problems, trust me.
As has been said above, it also requires changes to the template functions to change the links. Perhaps this is something that can be abstracted (like 'Permalink Structure' in Wordpress).
In the .htaccess file alone, here's how: The last rule:
Then all your image viewing pages will have /view.php after them. I might just make this an option, it'd be very easy. Let me know how it works for you.
Thank you very much, it works as expected except for one big thing.
The comment form with the action of "#" takes the user to the path of the image.php page (the large image detail page) *before* the "view.php" was added at the end, like this:
Okay. I figured out a non surgical way of doing it. Since the main objective for the view.php at the end is for search engines, I did the following in the .htacess file:
How to change .jpg to .html ?.... I tried the hack with view.php/html ... It works fine ....but I need to remove the .jpg part from the link . I tried hacking some classes and functions ...and change the $filename to $name in the links . It works .... I got links to look like this : /album/image file name (but no .jpg/.gif,etc).
I just need to add the .html part to the last part of the link. Any ideeas ?
That will make it work, theoretically, but you still have to change all the generated URL's in zenphoto (there are a lot of them) to output "`imagename`" instead of "`imagename.jpg`", which is tedious, but possible...
Again, you lose all support for anything but .jpg if you do this.
Comments
RewriteRule ^([^/\.]+)/([^/\\]+)$ index.php?album=$1&image=$2 [QSA,L]
with
RewriteRule ^([^/\.]+)/([^/\\]+)\.html$ index.php?album=$1&image=$2 [QSA,L]
it change bmw.jpg to bmw.jpg.html
but you can't change bmw.jpg to bmw.html, since php will not know it is a bmw.jpg or bmw.gif or ....
Also, you have change all the functions which generate URLs in the template-functions.php
$g_album = urlencode($g_album); $g_image = urlencode($g_image);
header("Location: " . "http://" . $_SERVER['HTTP_HOST'] . WEBPATH . "/" .
(zp_conf('mod_rewrite') ? "$g_album/$g_image" : "index.php?album=$g_album&image=$g_image"));
exit;
} else {
$stored = array($_POST['name'], $_POST['email'], $website, $_POST['comment'], false);
if (isset($_POST['remember'])) $stored[3] = true;
$error = true;
}
from template-functions.php
that needs to be modified but what in it needs to be modified
I would not recommend changing the filename handling. It will run you into MANY problems, trust me.
How do you add /view.php after the filename.jpg in the .htaccess file.
Thanks!
As has been said above, it also requires changes to the template functions to change the links. Perhaps this is something that can be abstracted (like 'Permalink Structure' in Wordpress).
In the .htaccess file alone, here's how: The last rule:
`RewriteRule ^([^/]+)/([^/\]+)$ index.php?album=$1&image=$2 [L,QSA]`
Becomes:
`RewriteRule ^([^/]+)/([^/\]+)/view.php$ index.php?album=$1&image=$2 [L,QSA]`
Then go through template-functions.php, find the function `getImageLinkURL()`, and on the line that reads:
` return WEBPATH . "/" . urlencode($_zp_current_album->name) . "/" . urlencode($_zp_current_image->name);`
Change it to:
` return WEBPATH . "/" . urlencode($_zp_current_album->name) . "/" . urlencode($_zp_current_image->name) . "/view.php";`
Then all your image viewing pages will have /view.php after them. I might just make this an option, it'd be very easy. Let me know how it works for you.
Thank you very much, it works as expected except for one big thing.
The comment form with the action of "#" takes the user to the path of the image.php page (the large image detail page) *before* the "view.php" was added at the end, like this:
http://www.domain.com/gallery/album-name/imagename.jpg - which returns a 404 error
instead of
http://www.domain.com/gallery/album-name/imagename.jpg/view.php
I did have to add the /view.php after the links in the themes.
<?=getPrevImageURL();?>/view.php
But everything I try with respect to the form, only returns a 404 error. For now, I'm just playing around with zenphoto, so it's no biggie.
Please let me know what I can do to fix this.
Thanks!
RewriteRule ^([^/]+)/([^/\]+)/view.php$ index.php?album=$1&image=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/\\]+)$ index.php?album=$1&image=$2 [L,QSA]
So when the comment is posted they go to the page with the file ending in .jpg, no big deal.
Anyway it works fine now.
I tried hacking some classes and functions ...and change the $filename to $name in the links .
It works .... I got links to look like this : /album/image file name (but no .jpg/.gif,etc).
I just need to add the .html part to the last part of the link.
Any ideeas ?
I would not recommend changing the filename handling. It will run you into MANY problems, trust me.
******
But how did you do it? I'm curious.
Why not do
album/imagefilename(without.jpg)/view.html
`RewriteRule ^([^/]+)/([^/]+)$ index.php?album=$1&image=$2 [L,QSA]`
Becomes:
`RewriteRule ^([^/]+)/([^/]+)$ index.php?album=$1&image=$2.jpg [L,QSA]`
That will make it work, theoretically, but you still have to change all the generated URL's in zenphoto (there are a lot of them) to output "`imagename`" instead of "`imagename.jpg`", which is tedious, but possible...
Again, you lose all support for anything but .jpg if you do this.