Subject:
|
Re: Previous and next links a la Brickshelf
|
Newsgroups:
|
lugnet.off-topic.geek
|
Date:
|
Wed, 25 Jul 2001 01:29:00 GMT
|
Viewed:
|
138 times
|
| |
| |
On Wed, Jul 25, 2001 at 01:07:51AM +0000, Bram Lambrecht wrote:
> Hi all,
> If I have a comma separated text file of the form:
> filename.ext,thumbnail width,thumbnail height,img width,img height
> for example:
>
> inside3.jpg,100,75,640,480
> over.jpg,100,75,640,480
> stairs.jpg,100,64,640,410
> tower.jpg,78,100,320,410
> trellis.jpg,78,100,320,410
> waterfall.jpg,100,75,640,480
>
> then what is the best way to grab the next and previous images if I am
> displaying, for example, "tower.jpg". (I'm using PHP, but I can work with perl
> too.) Thanks!
hmmm... dunno php, but try this in perl:
#!/usr/bin/perl -w
$current = shift;
$prev = '';
$next = '';
while (<>) {
($name) = split /,/;
if ($name eq $current) {
$next = <>;
($next) = split /,/, $next;
last;
}
$prev = $name;
}
this is untested, but if you put this in a file (say, call it match.pl),
and run it as "./match.pl stairs.jpg file.lst", it should end up with
$next = "tower.jpg" and $prev = "over.jpg". This doesn't check for
special cases (like the name matches the first or last line), but should
give you an idea...
HTH,
:)
--
Dan Boger
dan@peeron.com
|
|
Message has 1 Reply:
Message is in Reply To:
| | Previous and next links a la Brickshelf
|
| Hi all, If I have a comma separated text file of the form: filename.ext,thumbnail width,thumbnail height,img width,img height for example: inside3.jpg,100,75,640,480 over.jpg,100,75,640,480 stairs.jpg,100,64,640,410 tower.jpg,78,100,320,410 (...) (23 years ago, 25-Jul-01, to lugnet.off-topic.geek)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|