![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Registered User
Join Date: Nov 2005
Posts: 24
|
Addhandler Images into php or html
I know this is possible but cannot find it anywhere how to fix this. I would like to open all of my images into a php or html file using htaccess.
Following line were placed in htaccess: AddHandler headered .jpg Action headered /header/header.php Then in the header.php, I've placed: <?php $header = "header.html"; $footer = "footer.html"; $image = $_SERVER["PATH_TRANSLATED"]; readfile($header); readfile($image); readfile($footer); ?> But the above is opening images as a file. Please Help. Thanks.
__________________
http://www.silentpix.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,111
|
Quote:
My brain is full right this second but let me think on it for a couple. .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
You need to set the content type header for the file
__________________
Deranged World |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Jun 2006
Posts: 530
|
I dont even know where to start with explaining how bad that code right there is.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,111
|
Quote:
None of that is going to work for what you are trying to do.
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
Registered User
Join Date: Nov 2005
Posts: 24
|
Okay, since the code above won't work. Can someone lead me in the right direction? I've been looking around for a least 5 hours now.
__________________
http://www.silentpix.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
Quote:
If you're trying to keep people from stealing your images, don't put them online. Putting it into a file isn't going to help stop anyone but the most idiotic surfer. All you'll be doing is adding needless overhead to your site by requiring it to open & read and write files all the time. If your site is popular, this will increase the amount of memory being used up. This is because what you're trying to do is essentially reading all the binary data from an image into one big string. Only then will it be written to file. Second, ANY display of an image on a web page needs to be done using the <img> element. yes, it can be done with <object> if you're a masochist and want to overcome all the browser compatibility nightmares. So all a surfer has to do is find the path to the file (whether it is a PHP file or a real image file) and there he can download your file. If you think displaying it in PHP will overcome theft you're wrong. In case you've made it this far and don't care about what I've said, here ya go: PHP Code:
I skipped over the part where you get the mime type and the image size. Image size is easy to get. Getting the MIME type is more involved and hey, if you want me to write the whole thing for you, you can pay me. ;-) The code above needs to be saved as its own file. Then you call it as any other image in your HTML.
__________________
Deranged World |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Registered User
Join Date: Nov 2005
Posts: 24
|
Damn, I made it thus far but still don't know where to implement the above code. I am already protected my images buy using htaccess and only giving access to images on certain sites like this one. (Actually giving access to site gfy.com) Anywho, I just would like to open images on php instead of opening on browser. Eventually I would like to put a link above the image. If payment is what you want, so be it. So back to my original question, do I place the above code on all of my php pages?
__________________
http://www.silentpix.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,111
|
Quote:
The browser is always making the call to the server, delivering the image via a php script still displays the image in the browser. What exactly are you trying to accomplish with this? It originally looked to me like you were just trying to add a header and a footer to an image (watermarking it in essence) But, now I am thoroughly confused ![]() .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Registered User
Join Date: Nov 2005
Posts: 24
|
looking for something along this line.
gyrls.com/upload/show.php?image=0719.jpg
__________________
http://www.silentpix.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Confirmed User
Join Date: Oct 2006
Posts: 749
|
Quote:
I don't mean that to sound negative. I just think if we had a better idea of what exactly you're trying to accomplish we might be better equipped to answer you more effectively. It looks to me like the page you've referenced above does this: Code:
<html> <!--All the other stuff at the top of the document--> <body> <?php $image = $_GET['image']; // lots more should be done here, such as // input filtering and ensuring against XSS // then, check that the image actually exists before displaying it. print("<img src=\"img/$image\">"); ?> </body> </html>
__________________
Deranged World |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,111
|
Quote:
The method he was going at it at the beginning was what confused the issue. .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Registered User
Join Date: Nov 2005
Posts: 24
|
Basically this is what I need. All of my gallery images opens up in the browser like this.
silentpix.com/gallery/nsfw/planet-mandy-showing-off-huge-sexy-titties/00.jpg is there a way I can open all images to look like this... silentpix.com/image.html using htaccess so I don't have to recreate all htmls manually. Thank you in advance.
__________________
http://www.silentpix.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,111
|
Quote:
The <img> tag expects an image type file in return. If you return an html file to an <img> tage, the browser will not be able to display it. If you want to do what you are talking about from a thumb click than the url needs to reference a text type file (html, php, txt, whatever) to display it in the browser as html. That is all as "far as I know". .
__________________
All cookies cleared! |
|
![]() |
![]() ![]() ![]() ![]() ![]() |