FAP SUPPORT - Rewrite Jpg Url-s In Album »  Show posts from    to     

Icy Phoenix


Archived phpBB Topics (Styles, Mods, Support) - FAP SUPPORT - Rewrite Jpg Url-s In Album



User20 [ Mon 12 Feb, 2007 16:53 ]
Post subject: FAP SUPPORT - Rewrite Jpg Url-s In Album
Hello,

Is here any MOD with what I can rewrite urls
Something like that.
http://smartor.is-root.com/viewtopi...=asc&highlight=

Thanks


Artie [ Mon 12 Feb, 2007 21:05 ]
Post subject: Re: Rewrite Jpg Url-s In Album
That's basicly the same as this (from mg.com) ... and should work

PaulW wrote: [View Post]
Just posted on smartor's site... just a way of maybe including it as a new BBCode field or something for users to copy & then use in other forums (ones which dont allow .php extensions as image url links) and only allow IMG tags to use .JPG .GIF or whatever...

**PROBLEM ONLY**

I have this configured only for .JPG file uploads, so for things like .GIF and .PNG WONT work at all! unless there is another workaround for that, I'm sorry! I suppose you could add more lines to the rewrite code to allow .gif and .png extensions for the same, and then modify a script for the bbcode display to detect filetype & show relevant url?? i dont know

Via the .htaccess file, I am doing testing this now on my webasite, and it seems to work!

If you haven't already created a .htaccess file, do so in the ROOT of your forums...

then add this

Code: [Hide] [Select]
RewriteEngine On
RewriteBase /
RewriteRule ^album_pic_([0-9]*).jpg album_pic.php?pic_id=$1 [L,NC]




RewriteBase is the location of where the forum is, so if it is /phpbb then it should be /phpbb (i think)

I'm still new to the whole .htaccess idea, but it does work!


User20 [ Tue 13 Feb, 2007 18:36 ]
Post subject: Re: Rewrite Jpg Url-s In Album
I copied this to my forums root and it ain't work.
Could you please explain better?
What changes I need to do to show the pictures in other forums?
Thanks.


User20 [ Tue 13 Feb, 2007 18:37 ]
Post subject: Re: Rewrite Jpg Url-s In Album
And My ISP supports mod-rewrite.


Artie [ Tue 13 Feb, 2007 21:53 ]
Post subject: Re: Rewrite Jpg Url-s In Album
Works for me as below.......

My phpbb_root is web_root/forum and I placed the htaccess file in my web_root
Accessed the pic by MyDoman.com/pic_ID.jpg


Code: [Hide] [Select]
RewriteEngine On
RewriteBase /
RewriteRule ^pic_([0-9]*).jpg forum/album_pic.php?pic_id=$1 [L,NC]


If your web_root is also your phpbb_root try this.....

Code: [Hide] [Select]
RewriteEngine On
RewriteBase /
RewriteRule ^pic_([0-9]*).jpg album_pic.php?pic_id=$1 [L,NC]


Note that you must have Hotlink Prevention disabled (ACP) to use this short url in any domain other that yours (or have that domain in the allowed list)


nims [ Thu 12 Jul, 2007 13:33 ]
Post subject: Re: Rewrite Jpg Url-s In Album
Is it possible to rewrite user album urls ?

Like :
www.domain.com/forum/album.php?user_id=123
To
www.domain.com/forum/ablum/username/

I guess we need to fetch the username from the url in album.php and then get the user_id corresponding to this username and then process further. I am not very good at PHP but still I would try, but in the meantime if there are experts who would like to do it I would really appreciate.


nims [ Thu 12 Jul, 2007 18:03 ]
Post subject: Re: Rewrite Jpg Url-s In Album
OK I have done it but with some problems.
Its now successfully redirecting
www.domain.com/forum/album.php?username=someuser
to
www.domain.com/album/someuser/
But the problem is that its not picking the correct urls of images and other links since all the paths are relative. I need some help here.

Here is what I did : ********** PLEASE DO NOT TRY THIS YET **********


Open .HTACCESS file
Code: [Hide] [Select]
### Rewrite RULE FOR USER ALBUMS
RewriteRule ^album/([^/]+)/?$ /forum/album.php?username=$1 [QSA,L]

OPEN album.php
FIND
Code: [Hide] [Select]
elseif (isset ($_GET['user_id']))
{
$album_user_id = intval($_GET['user_id']);
}

AFTER ADD
Code: [Hide] [Select]
// Display album by username by Manish
elseif (isset ($_POST['username']))
{
$album_user_name = $_POST['username'];
$sql_1 = "SELECT * FROM ". USERS_TABLE . " WHERE username = '" . $album_user_name. "'
AND user_id <> " . ANONYMOUS;
if( !($result_1 = $db->sql_query($sql_1)) )
{
message_die(GENERAL_ERROR, 'Username '.$album_user_name.' does not exist', '', __LINE__, __FILE__, $sql_1);
}
elseif (isset ($_GET['username']))
{
$album_user_name = $_GET['username'];
$sql_1 = "SELECT * FROM ". USERS_TABLE . " WHERE username = '" . $album_user_name. "'
AND user_id <> " . ANONYMOUS;
if( !($result_1 = $db->sql_query($sql_1)) )
{
message_die(GENERAL_ERROR, 'Username '.$album_user_name.' does not exist', '', __LINE__, __FILE__, $sql_1);
}
$result_1 = $db->sql_query($sql_1);
$fetch_1 = $db->sql_fetchrow($result_1);
$album_user_id = $fetch_1['user_id'];

}
// display album by username by Manish ends

OPEN overall_header.tpl
Change the relative path of stylesheet to absolute
Code: [Hide] [Select]
<link rel="stylesheet" href="http://www.domain.com/forum/templates/subSilver/{T_HEAD_STYLESHEET}" type="text/css">


nims [ Thu 12 Jul, 2007 19:08 ]
Post subject: Re: Rewrite Jpg Url-s In Album
Ok I added the following and I think I am close

OPEN overall_header.tpl
FIND

<meta http-equiv="Content-Style-Type" content="text/css">
AFTER ADD
<base href="http://www.domain.com/forum/" />




Powered by Icy Phoenix