Author Topic: ospap - Alpha1  (Read 27414 times)

0 Members and 1 Guest are viewing this topic.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #90 on: October 12, 2005, 06:00:48 pm »
You should be able to append a .jpg/.gif/.whatever to the end of the url and have the browser cache it. Then use mod_rewrite or such on the server to fix it so that it gets processed by the php script.

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #91 on: October 12, 2005, 11:10:02 pm »

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

No they don't.
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
Doesn't look like an image extention to me.

What I am suggesting is that he could do
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
or
Code: [Select]
http://www.javaop.com/~iago/ospap/picture/tn-22.jpg
and then use mod_rewrite to force his php script (picture.php) to handle the request. This will allow browsers to cache the images but also allow access control in the event of private images.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #92 on: October 12, 2005, 11:39:42 pm »

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

No they don't.
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
Doesn't look like an image extention to me.

What I am suggesting is that he could do
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
or
Code: [Select]
http://www.javaop.com/~iago/ospap/picture/tn-22.jpg
and then use mod_rewrite to force his php script (picture.php) to handle the request. This will allow browsers to cache the images but also allow access control in the event of private images.

I don't think the prior would work (I know you could get it to work, but it would defeat the purpose of what you're trying to accomplish), but the second thing you suggested is what I recommended to begin with.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #93 on: October 12, 2005, 11:52:27 pm »
I don't think the prior would work (I know you could get it to work, but it would defeat the purpose of what you're trying to accomplish), but the second thing you suggested is what I recommended to begin with.

Its not at all, stop getting caught up in the urls and go read+learn about lovely things like mod_rewrite.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #94 on: October 13, 2005, 12:04:13 am »
Hmm, that seems like a lot of trouble :-/

And yeah, if they're stored on a public path, then yeah, they can be viewed by directly typing in the URL.  But I don't store them on a public path. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #95 on: October 13, 2005, 12:15:07 am »
* Sidoh shrugs.

'twas a simple suggestion.  :P

I don't really see the big deal behind having users knowing the URL to the thumbnail files.  :P
« Last Edit: October 13, 2005, 12:17:09 am by Sidoh »

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #96 on: October 13, 2005, 09:14:57 pm »
Whats that checkbox next to "Create" do? (Create a category)

Log me in immediatly after registering =)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #97 on: October 14, 2005, 01:17:51 pm »
Whats that checkbox next to "Create" do? (Create a category)
Makes the category private, if you read the mouse over. :P
And like a fool I believed myself, and thought I was somebody else...

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #98 on: October 14, 2005, 08:14:28 pm »
Yep, and that loads the thumbnail file:
Quote
        if(isset($_GET['tn']) && $_GET['tn'] == "true")
                $tn = true;
        else
                $tn = false;

// ...................

        if($tn == true)
                show_image("$upload_directory/tn-$file");
        else
                show_image("$upload_directory/$file");

Your code could be more efficient ^^
IE: $tn is already assigned the value of $_GET['tn'], and since there is no type declaration, you can use true instead of "true".  There, I just saved you a cycle or two.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #99 on: October 14, 2005, 08:28:36 pm »
Hehe.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #100 on: October 14, 2005, 10:34:34 pm »
Yep, and that loads the thumbnail file:
Quote
        if(isset($_GET['tn']) && $_GET['tn'] == "true")
                $tn = true;
        else
                $tn = false;

// ...................

        if($tn == true)
                show_image("$upload_directory/tn-$file");
        else
                show_image("$upload_directory/$file");

Your code could be more efficient ^^
IE: $tn is already assigned the value of $_GET['tn'], and since there is no type declaration, you can use true instead of "true".  There, I just saved you a cycle or two.

Yeah, but I like my way better.  It's a little more clear to read, in my opinion. 

I really hate untyped languages.  I even like Perl, which lets me declare variables (my $var), but php doesn't let me declare the existance of a variable.  That bugs me. 

But yeah, a couple cycles isn't worth a reduction in clarity. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #101 on: October 14, 2005, 10:58:08 pm »
Yes it does.

Code: [Select]

class img {

  var $img;
  var $color_back;

  ...

}

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #102 on: October 14, 2005, 11:22:54 pm »
Hell, you don't even need a class to do it :\

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #103 on: October 14, 2005, 11:35:38 pm »
Is there some way to make it show an error if you don't declare variables like that?

On Perl, it's "use strict;"

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #104 on: October 15, 2005, 02:01:11 am »
Hell, you don't even need a class to do it :\
Hehe, yeah.  Was just an example.  :)

Is there some way to make it show an error if you don't declare variables like that?

On Perl, it's "use strict;"
You might check in php.ini, but I kinda doubt it's possible.  All PHP articles/books I've read state that PHP variable declarations are soley implicit (at least the datatype can never be explicitly defined, or at least that I'm aware of).