News:

Happy New Year! Yes, the current one, not a previous one; this is a new post, we swear!

Main Menu

ospap - Alpha1

Started by iago, September 14, 2005, 06:46:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sidoh

Quote from: zorm on October 12, 2005, 02:47:54 AM
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.

zorm

Quote from: Sidoh on October 12, 2005, 06:00:48 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.

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

http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg

or

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

Sidoh

Quote from: zorm on October 12, 2005, 11:10:02 PM
Quote from: Sidoh on October 12, 2005, 06:00:48 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.

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

http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg

or

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.

zorm

Quote from: Sidoh on October 12, 2005, 11:39:42 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

iago

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. 

Sidoh

#95
* 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

Joe

Whats that checkbox next to "Create" do? (Create a category)

Log me in immediatly after registering =)
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Blaze

Quote from: Joe[e2] on October 13, 2005, 09:14:57 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...

rabbit

Quote from: iago on October 11, 2005, 08:21:27 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.

Sidoh


iago

Quote from: rabbit on October 14, 2005, 08:14:28 PM
Quote from: iago on October 11, 2005, 08:21:27 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. 

Sidoh

Yes it does.



class img {

  var $img;
  var $color_back;

  ...

}

rabbit

Hell, you don't even need a class to do it :\

iago

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

On Perl, it's "use strict;"

Sidoh

Quote from: rabbit on October 14, 2005, 11:22:54 PM
Hell, you don't even need a class to do it :\
Hehe, yeah.  Was just an example.  :)

Quote from: iago 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;"
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).