Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post FAP SUPPORT - Rewrite Jpg Url-s In Album 
 
Hello,

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

Thanks
 



 
User20Send private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post 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: [Download] [Hide] [Select]
   RewriteEngine On  
   RewriteBase /  
   RewriteRule ^album_pic_([0-9]*).jpg album_pic.php?pic_id=>    RewriteRule ^album_pic_([0-9]*).jpg album_pic.php?pic_id=$1 [L,NC] < [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!

 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
User20Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: Rewrite Jpg Url-s In Album 
 
And My ISP supports mod-rewrite.
 



 
User20Send private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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: [Download] [Hide] [Select]
RewriteEngine On  
RewriteBase /
RewriteRule ^pic_([0-9]*).jpg forum/album_pic.php?pic_id=> RewriteRule ^pic_([0-9]*).jpg forum/album_pic.php?pic_id=$1 [L,NC]< [L,NC]


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

Code: [Download] [Hide] [Select]
RewriteEngine On  
RewriteBase /
RewriteRule ^pic_([0-9]*).jpg album_pic.php?pic_id=> RewriteRule ^pic_([0-9]*).jpg album_pic.php?pic_id=$1 [L,NC]< [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)
 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
nimsSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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: [Download] [Hide] [Select]
### Rewrite RULE FOR USER ALBUMS
RewriteRule ^album/([^/]+)/?$ /forum/album.php?username=> RewriteRule ^album/([^/]+)/?$ /forum/album.php?username=$1 [QSA,L] < [QSA,L]

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

AFTER ADD
Code: [Download] [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: [Download] [Hide] [Select]
<link rel="stylesheet" href="http://www.domain.com/forum/templates/subSilver/{T_HEAD_STYLESHEET}" type="text/css">

 



 
nimsSend private messageVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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/" />
 



 
nimsSend private messageVisit poster's website  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events


  

 

  cron