Page 1 of 1

URL 'n' Image

Posted: Thu Sep 26, 2002 11:13 am
by Dale
Instead of me writing the address to the images and making 259 sepaate pages for these images is it possible to have this:

When your URL is:
http://www.cheese.com/gallery/index.php?img=01

Your IMAGE tag changes to:
http://www.cheese.com/gallery/dale/image01.jpg


Your kinda code:
http://www.cheese.com/gallery/dale/image$img.jpg

Is it possible and if it isnt then could you please correct it :)

Re: URL 'n' Image

Posted: Thu Sep 26, 2002 3:18 pm
by jason
Dale wrote:Instead of me writing the address to the images and making 259 sepaate pages for these images is it possible to have this:

When your URL is:
http://www.cheese.com/gallery/index.php?img=01

Your IMAGE tag changes to:
http://www.cheese.com/gallery/dale/image01.jpg


Your kinda code:
http://www.cheese.com/gallery/dale/image$img.jpg

Is it possible and if it isnt then could you please correct it :)
image.php

Code: Select all

<img src="dale/image<?=$_GETї'img']?>.jpg" />
Of course, that doesn't include things like checking the input, making sure the file exists, etc, but should get you stared.

Posted: Thu Sep 26, 2002 3:34 pm
by Dale
ok my picture thing works but also if i add a .TXT file into the same directory as the image and name the image image01.jpg and the text file image01.txt can i include:

Code: Select all

<?=$_GETї'img']?>
Inside a include tag?

Posted: Thu Sep 26, 2002 3:54 pm
by Dale
I've tried this:

Code: Select all

<img src= "./dale/image<?=$_GETї'img']?>.jpg"><br><br>
<?PHP 
include("image<?=$_GETї'img']?>.txt");
?>
But that dont work :(

I get this:

Code: Select all

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/etc/httpd/dale.unrealism.com/gallery/index.php on line 10
Any ideas?

Posted: Thu Sep 26, 2002 4:06 pm
by Takuma
Try this to include the text file:-

Code: Select all

<img src= "./dale/image<?=$_GETї'img']?>.jpg"><br><br> 
<?php  
include("image{$_GETї'img']}.txt");
?>
If you want to print the content of the txt file use:-

Code: Select all

<img src= "./dale/image<?=$_GETї'img']?>.jpg"><br><br>
<?php
  $fh = fopen("image{$_GETї'img']}.txt","r");
  $content = fread($fh,filesize("image{$_GETї'img']}.txt"));
  echo $content;
  fclose($fh);

Posted: Thu Sep 26, 2002 4:21 pm
by Dale
Takuma if i had the transport to goto Derby... i would kiss you (NOTE: Im not gay) because you've fixed another one of my problems...

Posted: Thu Sep 26, 2002 4:24 pm
by Takuma
Whatever you do just don't kiss me :wink:
Just hug me :lol:

Posted: Thu Sep 26, 2002 4:26 pm
by Dale
Image