PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Lets say I have a page with an image. Is there any way to add a permalink to the image, and when a user clicks it, a new static page with the image embedded is created?
Lets say my page is called index.php and the image is called 13332fun.jpg. The new page would be 13332fun.php or 13332fun.html with 13332fun.jpg embedded.
You see I am creating an online gallery, with a banner rotator. It's great but it's not very good for visitors to bookmark the image (everything is loaded on one page). If they want so share it they have to view image, then send the image link to friends. It would be cool to instead have the image have it's own page they can share.
Because I want a way for people to DIGG, bookmark etc. And have the ability to add banners if I wish. I can't do that with just a JPG. It would be cool to have a page where people can comment on the image too, and rate it. I can't even add a Home link to just a JPG.
$pic = mysql_real_escape_string($_GET['n']);
echo '<img src="http://www.site.com/pictures/' . $pic . '.jpg" />'
So you can generate a url like
http://www.site.com/view.php?n=123
PHP will take the variable 123 in the url, and echo it in the img tags. The same concept can be applied to the digg URL.
Although there's no point in running mysql_real_escape_string() on $_GET['n'] unless you're using it in a query. You should, however, run urldecode() on it to replace any special url characters, and basename() to make sure no one's being naughty (incase you don't have open basdir restriction turned on, which you probably do...but best to be safe).
You wouldnt happen to have a bit of code example I would put in the view.php file and in my main HTML page (above the image) would you? I know it's asking a lot, but it would help tremendously.
I want to create a "permalink" above the image so when you click the link it would go to a new page called image1.html, with the image in it. And the new page (image1.html) could be customized with a .css file etc.
Sorry if I appear very newbish (I am), it's all so new to me.
Right, the problem I am having is that I have no way of passing the name of the image in the div (and path to the image) into view.php. Each image name, and path to the image, is unique so how would I do that? Any ideas?
I have thumbnails in one div, and when you click the thumbnail you see the full image in another div. I used some javascript I found to do that. I think it just scans the main image div for an IMG tag and places the main image there.
I have never needed to use jquery, so I unfortunately don't know what that code does...
Although I found the concept quite interesting so I decided to have a go. I wouldn't normally just write code for someone, but since I found this quite intriguing....I'll make an exception
This should work. Just do <img src"..." onclick="img.new_img(this);" /> for each image.