rejetto forum

Image hosting and viewing

Guest · 26 · 8137

0 Members and 1 Guest are viewing this topic.

Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Wouldn't this solve your problems:

Users have to go to the root of your website and login there. They then have to browse their way to their own folder to upload / delete images.
Anyone who tries to view the folder contents without being logged in would see a 401 unauthorized page.

To achieve this, you need to right click the main folder that contains all the sub folders for your users (I believe you called it "Image Hosting") and select properties. Go to diff template and paste there the main section of the template you are using (the section called []).

Now modify the text you just pasted so it looks like this:

Code: [Select]
{.if|%user%|
<<Place the original template code here>>
|
<html><head></head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested.</p>
<hr>
<p>Please <a href="/">go back</a> and provide valid login credentials.</p>
</body></html>
.}

It basically checks if a user is logged in before showing the template. If a user is not logged in, it shows a custom 401 error page.
If a user or someone else from the internet requests an image download, it simply shows the image.

Note: be sure to disable file listing, as anyone would be able to request and view it.


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
On the part where it says

Code: [Select]
<<Place the original template code here>>
do you mean whats listed in the entire hfs.tpl?

Oh and if someone goes to "Image Hosting" (as it sits right now) they can see no user folders. When they sign in they can only see theirs.


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Quote from: DNic41
On the part where it says

Code: [Select]
<<Place the original template code here>>

do you mean whats listed in the entire hfs.tpl?

Not the entire template, only the main part. Either the [] section or the most top part of the template (until a new section starts), this depends on the template you are using.

Quote from: DNic41
Oh and if someone goes to "Image Hosting" (as it sits right now) they can see no user folders. When they sign in they can only see theirs.

With the method i gave you, a regular visitor will see the 401 error page. A loggedin user will only see his or her folder.


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
I'm using the default template (haven't played with this yet).

I posted your code and what I think to be the first section of the template. I get the 401 msg if I click on Image Hosting w/o signing in and if I sign in I can get to the folder.

However on the top of the users folder I have this:

Code: [Select]
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

so I must've not copied the exact right amount or too much. Also I tried using a link to an uploaded image and it still asks for a password.


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
I'm using the default template (haven't played with this yet).

I posted your code and what I think to be the first section of the template. I get the 401 msg if I click on Image Hosting w/o signing in and if I sign in I can get to the folder.

However on the top of the users folder I have this:

Code: [Select]
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

so I must've not copied the exact right amount or too much.

It seems you are missing a "<" thats supposed to be in front of the !DOCTYPE thingy. Just insert a "<" to fix this.

Quote
Also I tried using a link to an uploaded image and it still asks for a password.

Ok, i forgot to mention that :P. Go to the properties page of a user folder and check the 'anonymous' box in the 'access' tab. This makes it so that everyone who is NOT loggedin will have access to that folder. You will have to do this for every user folder.

A different user who is also logged in will NOT see the folder of other users because of the anonymous checkbox (cause he is not anonymous). If he, however, clicks on a direct image link, he will still be able to download the image.

Hope it works now :P
« Last Edit: November 21, 2008, 09:08:28 PM by Giant Eagle »


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
Ah can't believe the simple < that I missed!

Thanks a ton Eagle! It works exactly the way I want it now. User can upload images and give out the links w/o exposing any other pics they uploaded.

Where can I find out more info about the diff template section? Also when I do use a different template style will this affect the diff template section of "Image Hosting"?


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Ah can't believe the simple < that I missed!

Thanks a ton Eagle! It works exactly the way I want it now. User can upload images and give out the links w/o exposing any other pics they uploaded.

Great, and you're welcome ;D

Quote from: DNic41
Where can I find out more info about the diff template section?

There is not much to it.
Everything you enter in the diff template box will 'overwrite' the main template. Meaning you can choose to only overwrite one [section], or the whole template. This effect only takes place on the folder you used the diff template on and all the underlying sub folders.

Quote from: DNic41
Also when I do use a different template style will this affect the diff template section of "Image Hosting"?

Yes, you will need to copy the main section (Either the [] section or the most top part) of the new template and place that in the diff template box of the "Image Hosting" folder.
« Last Edit: November 21, 2008, 10:09:23 PM by Giant Eagle »


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
I switched to the RAWR template and copied over the template changes, but its doesn't work now.
Now (w/o logging in) i can see all the user folders instead of getting a "Authorization Required" message, and can access them. (Which a non logged user shouldn't be able to due since I have "List protected items for allowed users" checked)

So I decided I can just use the way I had it with the default HFS template, but when I enter that in the page is all out of whack.

Look forward to your input/help.


Offline Giant Eagle

  • Tireless poster
  • ****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Install the RAWR-Template on your hfs, then apply the following code as the 'Diff Template' on "Image Hosting".

Code: [Select]
[]
{.if|%user%|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
{.$disclaimer.}
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="robots" content="noindex,nofollow"/>
<title>{.!lv_title.} - {.!lv_home.}%folder%</title>
<script type="text/javascript" src="/template/rawr_default/code/rawr_main.js"></script>
<script type="text/javascript" src="/template/rawr_default/code/rawr_previewbox.js"></script>
<link rel="stylesheet" type="text/css" href="/template/{.!theme.}/code/{.!theme.}_main.css"/>
<script type="text/javascript">
var serverFolder="%folder%";
var serverHost="%host%";
var theme="{.!theme.}";
var mod_folder_tasks="{.!mod_folder_tasks.}";
var mod_statistics="{.!mod_statistics.}";
var mod_shoutbox="{.!mod_shoutbox.}";
//Language Strings
var lv_loading="{.!lv_loading.}";
var lv_advSearch="{.!lv_advSearch.}";
var lv_search="{.!lv_search.}";
var lv_searchAlert="{.!lv_searchAlert.}";
var lv_files="{.!lv_files.}";
var lv_folders="{.!lv_folders.}";
var lv_both="{.!lv_both.}";
var lv_recursive="{.!lv_recursive.}";
var lv_current="{.!lv_current.}";
var lv_root="{.!lv_root.}";
var lv_hideTitle="{.!lv_hideTitle.}";
var lv_showTitle="{.!lv_showTitle.}";
</script>
<noscript><style type="text/css">.hide{display:none}</style></noscript>
<!--[if lte IE 6]><style type="text/css">#mainInner{width:980px}</style><![endif]-->
</head>
<body>
<div id="mainOuter">
<div id="mainInner"><div id="mainInner1"><div id="mainInner2"><div id="mainInner3">
<div id="header">
<div><div id="bCrumbs">{.breadcrumbs|{:<a href="%bread-url%">{.or|%bread-name%|{.!lv_home.}.}/</a>:}.}</div></div>
</div>
<div id="content">
<div id="navbar">
{.if not|%user%|<div class="bigBtn"><a href="~login"><span>{.!lv_login.}</span></a></div>.}
<div class="bigBtn">
<a href="javascript:openTransfers()" class="hide"><span>{.!lv_transfers.}</span></a>
<noscript><a href="/~progress" target="_blank"><span>{.!lv_transfers.}</span></a></noscript>
</div>
{.if|{.get|can upload.}|<div class="bigBtn"><a href="~upload" title="{.!lv_uploadTitle.}"><span>{.!lv_upload.}</span></a></div>.}
{.if|{.{.!btn_back.}=on.}|{.if not|{.%folder%=/ .}|<div id="backBtn"><a href=".."><span>{.!lv_back.}</span></a></div>.}.}
</div>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td width="100%" valign="top" id="tableCol">
%folder-comment%
{.$files.}
</td>
{.if|{.match|{.!mod_folder_tasks.};{.!mod_statistics.};{.!mod_shoutbox.}|on.}|
<td width="175" valign="top" id="moduleCol">
<span id="specialBox"></span>
{.if|{.match|127.*;10.*;192.168.*|%ip%.}|
<div class="module">
<div class="modHeading">
<span><img src="/template/rawr_default/images/spacer.gif" width="8" align="top" alt=""/></span>
{.!lv_check.}
</div>
<div class="modContent">
{.if|{.?updates.}|
{:
{.set|new_build|{.load|http://rawr-designs.com/updater.php?project=template&ext=.txt.}.}
<span>[{.!build.}]</span>{.!lv_currentBuild.}:<br/>
<span>[{.^new_build.}]</span>{.!lv_latestBuild.}:
<div class="divide">
<center>
<a href="http://rawr-designs.com/?page=template" target="_blank">
-
{.if|{.{.^new_build.}={.!build.}.}|{.!lv_homepage.}|{.!lv_download.} {.^new_build.}.}
-
</a>
</center>
</div>
:}
|<center><a href="http://%host%%encoded-folder%?updates=1">- {.!lv_checkNow.} -</a></center>.}
</div>
</div>
.}
{.if|{.{.!mod_folder_tasks.}=on.}|
<div class="module">
<div class="modHeading">
<span>
<a href="javascript:pinModule('Folder_Tasks')" id="Folder_Tasks_Link" title="{.!lv_hideTitle.}"><img
class="hide" src="/template/{.!theme.}/images/hide.gif" align="top" alt=""/>
<noscript><img src="/template/rawr_default/images/spacer.gif" width="8" align="top" alt=""/></noscript>
</a>
</span>
{.!lv_folderTasks.}
</div>
<div class="modContent" id="Folder_Tasks">
{.if|{.{.!mod_search.}=on.}|
<form action="/" name="simpleSearch" method="get">
<input class="formInput" type="text" name="search" size="13" maxlength="32" value="{.$search-data.}" onclick="if(this.value=='{.$search-data.}')this.value=''"/>
<input type="submit" value="Go"/>
</form>
<a href="javascript:initPreviewBox('specialBox','search')" class="hide">{.!lv_advSearch.}</a>
.}
{.if|%number%|
<div {.if|{.{.!mod_search.}=on.}|class="divide".}>
{.!lv_sortBy.}:<br/>
<a href="{.get|url|sort=t|rev={.and|{.?sort=t.}|{.not|{.?rev.}.}.}.}">{.!lv_age.}</a>,
<a href="{.get|url|sort=d|rev={.and|{.?sort=d.}|{.not|{.?rev.}.}.}.}">{.!lv_hits.}</a>,
<a href="{.get|url|sort=n|rev={.and|{.?sort=n.}|{.not|{.?rev.}.}.}.}">{.!lv_name.}</a>,
<a href="{.get|url|sort=s|rev={.and|{.?sort=s.}|{.not|{.?rev.}.}.}.}">{.!lv_size.}</a>,
<a href="{.get|url|sort=e|rev={.and|{.?sort=e.}|{.not|{.?rev.}.}.}.}">{.!lv_type.}</a>
</div>
<div class="divide">
<span>[%number-files%]</span>{.!lv_files.}:<br/>
<span>[%number-folders%]</span>{.!lv_folders.}:<br/>
<span>[%number%]</span>{.!lv_totalObjects.}:<br/>
<span>[%total-size%]</span>{.!lv_totalSize.}:
</div>
<div class="divide">
&nbsp;&#8226;<a href="?tpl=list&amp;folders-filter=%5C{.if|{.get|can recur.}|&amp;recursive.}" target="_blank" title="{.!lv_fileListingTitle.}"> {.!lv_fileListing.}</a>
{.if|{.get|can archive.}|<br/>&nbsp;&#8226;<a href="%folder%~folder.tar{.if|{.get|can recur.}|?recursive.}" title="{.!lv_archiveTitle.}"> {.!lv_archive.}</a>.}
{.if|{.get|can upload.}|<br/>&nbsp;&#8226;<a href="~upload" title="{.!lv_uploadTitle.}"> {.!lv_upload.}</a>.}
</div>
.}
</div>
</div>
.}
{.if|{.{.!mod_statistics.}=on.}|
<div class="module">
<div class="modHeading">
<span>
<a href="javascript:pinModule('Statistics')" id="Statistics_Link" title="{.!lv_hideTitle.}"><img
class="hide" src="/template/{.!theme.}/images/hide.gif" align="top" alt=""/>
<noscript><img src="/template/rawr_default/images/spacer.gif" width="8" align="top" alt=""/></noscript>
</a>
</span>
{.!lv_statistics.}
</div>
<div class="modContent" id="Statistics">
<div id="stats">{.$stats.}</div>
{.if|{.{.!sym_ip.}=on.}|<br/><span>[%ip%]</span>{.!lv_yourIp.}:<br/>.}
{.if|%user%|<span>[%user%]</span>{.!lv_yourId.}:.}
</div>
</div>
.}
{.if|{.{.!mod_shoutbox.}=on.}|
<div class="module">
<div class="modHeading">
<span>
<a href="javascript:pinModule('Shoutbox')" id="Shoutbox_Link" title="{.!lv_hideTitle.}"><img
class="hide" src="/template/{.!theme.}/images/hide.gif" align="top" alt=""/>
<noscript><img src="/template/rawr_default/images/spacer.gif" width="8" align="top" alt=""/></noscript>
</a>
</span>
{.!lv_shoutbox.}
</div>
<div class="modContent" id="Shoutbox">
<iframe src="/template/rawr_default/shoutbox/display_posts/?sort=t&rev=1" height="240" width="153" frameborder="0"></iframe>
</div>
</div>
.}
</td>
.}
</tr>
</table>
</div>
<div id="footer">
<br/>
<div>{.!lv_poweredBy.}: <a href="http://www.rejetto.com/hfs">rejetto HFS</a> (%version%, build %build%) &amp; <a href="http://rawr-designs.com">RAWR-Designs</a>.</div>
{.!lv_buildTime.}: %build-time%sec
</div>
</div></div></div></div>
</div>
<script type="text/javascript">pageLoad()</script>
</body>
</html>
|
<html><head></head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested.</p>
<hr>
<p>Please <a href="/">go back</a> and
provide valid login credentials.</p>
</body></html>
.}

The RAWR-Template works a bit different than the default template, but this should work. ;)


Offline Ranger

  • Tireless poster
  • ****
    • Posts: 115
    • View Profile
That did the trick, thanks a million! I was scratching my head for a bit on that one.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
i would put in the IF just little more than the %list%.
but if you found something working, happy end.