ciber Posted June 29, 2008 Share Posted June 29, 2008 Ok something now ive been trying to work out for a while with regards to hotlinking ect... Anyways, I want to create a php file that will be able to show an image, but the url will direct to the image. for example if the url is http://www.mysite.com/images/pic.jpg I need it to process the url, like so http://www.mysite.com/showimage.php?url=http://www.mysite.com/images/pic.jpg does anyone know where i could get a script that can do this for me, that when I put the url in it will display the image in the page. Thanks Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/ Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 You mean something like this? $maxImageSize = 200; // Max length of filename $image = addslashes(strip_tags(urldecode($_GET['image']))); $image = substr($image, 0, $maxImageSize); echo "<img src=\"$image\" border=\"0\" />\n"; Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577193 Share on other sites More sharing options...
ciber Posted June 29, 2008 Author Share Posted June 29, 2008 AWESOME! Thanks What im wanting to do is use this so when people visit my site they can see the screenshots still - you see I run a gaming site so I get a lot of hits to my image.jpg files, and im not able to record my hits then. How do you suggest that I do my htaccess so that it will take the url and redirect it to that file and shows the image? Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577200 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 Unfortunately I know little about .htaccess files but there are ways to accomplish things. If you explain a little more I may be able to help you. What url will someone be requesting to see a picture? Do you want to redirect them to the actual picture? I'm confused! Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577213 Share on other sites More sharing options...
ciber Posted June 29, 2008 Author Share Posted June 29, 2008 When a user visits the site, with a direct link to an image (eg: www.mysite.com/picture.jpg) Basically I dont want people to hotlink my images onto other peoples sites, but if they visit my site i want it that they are able see these picture (while also recording the visitor hits as well) I want the htaccess to redirect them to the file you have mentioned in the first post, so that the image is shown in the html file. eg: www.mysite.com/image.php?image=www.mysite.com/picture.jpg does this make sense? Thanks Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577239 Share on other sites More sharing options...
br0ken Posted June 29, 2008 Share Posted June 29, 2008 Yes, I understand clearly now however this will require .htaccess work and that is something I've never really done so I will be of little help to you. No doubt many other people on this forum will be able to help you though. Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577243 Share on other sites More sharing options...
ciber Posted June 29, 2008 Author Share Posted June 29, 2008 ok - i will just wait for someone to reply, but thanks for your help - its been very grateful and has helped me A LOT!! Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577244 Share on other sites More sharing options...
ciber Posted June 29, 2008 Author Share Posted June 29, 2008 I got the htaccess to work.... thanks again!!! Link to comment https://forums.phpfreaks.com/topic/112431-solved-php-image-viewer/#findComment-577254 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.