Technical Help & Discussion > Website Design & Programming
php advice needed
sam:
ooh just like that page, eh?
Interesting problem - not sure why anyone would wanna do that but still.
The milliondollar website cheats... they make a large png file: http://www.milliondollarhomepage.com/img-pix/image-map.png?r=397
This could be done in imagemagik (what does the server run?) and then they overlay a grid..
--- Code: ---<area onmouseover="d(this)" onmouseout="e(this)" shape="rect" coords="630,310,640,320" href="http://www.getpixel.net" title="getpixel.net, stock photography"/>
--- End code ---
Do you have todo it in PHP?
I guess in php you could just make a grid of images, now you'd have to do some image location optimisation to get it like that though.. just need to create an array of images and loop over them in the html.
I'll have a think a bit more - I've been coding in python all day and a bit wiped now.
psp83:
Thanks for the reply sam.
The server is PHP 5 with GD and not imagemagik :(
Do i have to do it in PHP ? Well to be honest no, It can be done in javascript aswell. But i'm limited to what i can work with here. I'm just doing extras to a site already coded.
I have an array of the images and sizes.
--- Code: ---Array
(
[0] => Array
(
[image] => ad30x70.jpg
[width] => 30
[height] => 70
)
[1] => Array
(
[image] => ad70x30.jpg
[width] => 70
[height] => 30
)
)
--- End code ---
Thats the only data i have to work with.
And to be honest with you.. I have no idea where to start with this.
Paul
sam:
well if you could take the data from the array then you could easily cast it into a grid (case below would just be 1 x 1) .. in the below case each image is called photo*.jpg (* = 1 - 9), $image_path = the location of the images and $toptext = some kind of array or individual element that has the alt text for the image. ...
--- Code: ---<?php
for($i=0; $i<=9; $i++) {
?><li> <a href="<?php echo $image_path; ?>photo<?php echo $i;
?>.jpg"><img src="<?php echo $image_path; ?>photo<?php echo $i; ?>.jpg"
alt="<?php echo $toptext; ?>" /> <img src="<?php echo $image_path;
?>photo<?php echo $i; ?>.jpg" alt="<?php echo $toptext; ?>" /></a> <br /> <?php }
?>
--- End code ---
I'm unsure how todo this in a more random manner like in the website example... will have a think
psp83:
Hi.
This is what I've got so far..
Now just to remove the spaces to make it like million dollar website.
Paul
sam:
excellent, how did you generate the above?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version