I have a script that displays the images via php. www.maindomain.com/image.php?img=test.jpg serve images, and i have other sites, where these images are displayed like this
<img src="www.maindomain.com/image.php?img=test1.jpg">
But this script, for show image is on my www.firstsite.com and www.secondsite.com. Is posibble to log which site is showing image? (put it to database for example).
I know, i can use $_SERVER['HTTP_REFERER'] but it's not 100%. Any other ideas?
The only 100% failsafe way to do it is to share the same image with different URLs. F.i. www.maindomain.com/image.php?test1.jpg&ref=first and www.maindomain.com/image.php?test1.jpg&ref=second. As actually this images are not requested by first or second servers but by visitor's browsers. Having different GET params in URL makes it easy to log data you need.
Related
My question is about HTML and PHP.
This is my setup right now:
A website where user have accounts
A FTP server with pictures (currently none)
Files are currently saved on the website in the "PICTURES" folder (which is accessible by everybody who know the full URL)
So, I would like to know how I can display the images without storing them on the website (which will fix my URL problem).
My idea was to move the files on the FTP server, and when a users logon and request a page with those images, download them through a FTP connection, save them on the website, display the images, and remove them. Which would make them accessible only between the downloading time. But this solutions sounds REALLY bad to me.
You need always to have a place where your images are stored. But, if you don't want to give a user the chance to know where are stored, you can create a system which is used to show the images.
Think about this, if you want to download a file from Mega, you can't access to the URL where the file is stored, instead of that, the server itselfs calls a system who assign you a "key" and you can download the file only through that system using your "key".
You could use a system like "base64" so you can encode your image, and show it using it, or, you can use the "header" modifier so, you can display an image using a PHP code.
For example your image tag will be like:
<img src="processImage.php?id=01&user=10&key=123" />
So, your processImage will return a "tricky" image, actually not the image, but the code processed by PHP will be returned, like using "imagejpg()" function with the header "Content-Type:image/jpeg" and then the user will not know where the image is stored actually but the img will works actually.
So I'm working on a project to fetch images from fashion websites. Now I'm implementing the add item function in the website. In this function, user needs to input website url first, then the web scraper will scrape the target images' url and pass the urls to the curl to download the image. Finally the add item popup window will preview the images I fetched in the previous step and ask the user to fill out some basic information for the items. Everything works fine except that the curl will take a very long time to download the images (cuz the images from those fashion website are often very high-quality). So I'm wondering is there a way I can create a preview without actually downloading the full-size images and do the download when the user fill out basic information later. Thanks!
If the fashion website has smaller versions of the images, you should download those first. You can use them for your preview.
If the fashion website only has the full size image, there is no way to download a smaller version of it.
You probably know what your doing, but remember that you should respect the copyright of images on websites, especially art websites such as fashion websites. Be careful with what you do with them.
How could I use imagegrabscreen to get a thumbnail image and a full size image of a specific website.
I was thinking that I could have an array that I feed the wanted uri's into but I am a bit stuck on how I would set the wxh of the image I need to grab. I also think that I would need a thumbnail class and a fullimage class and call them when required.
Any better Ideas?
Keep in mind that imagaegrabscreen is Windows-only. If you have multiple displays set up, this function will only grab the primary display. Also, for this to work, your Apache service must be set to Allow service to interact with desktop otherwise you will just get a blank image.
This discussion covers the use of imagegrabscreen pretty well: Getting imagegrabscreen to work
There are a lot of other discussions about saving webpages as images, too - here are a few:
Website screenshots
Web Page Screenshots with PHP?
How can I generate a screenshot of a webpage using a server-side script?
PHP: How to capture browser window screen with php?
What is the best way to create a web page thumbnail?
Screenshot of current page using PHP
shell tool which renders web site including javascript
In any languages, Can I capture a webpage and save it image file? (no install, no activeX)
Using shadowbox, I am displaying my images onto the screen like this:
<img src="images/thumbpic.jpg" width="100px" />
However I am looking for way to mask the image so that the URL path is not displayed. Otherwise the user will be able to access the image directly, by typing the URL into their address bar.
How can I do this?
This is not possible at all, since it's all client side and there's always a way to get that image. Same answer is for CSS & JS.
Disabling a hotlinking wouldn't help you, since this case has nothing to do with it (because you said by typing the URL into their address bar).
You could embed the image directly in the page. You then can't hotlink it and it would only be accessible from that page.
Here's an example: http://www.sweeting.org/mark/blog/2005/07/12/base64-encoded-images-embedded-in-html
Though, I don't believe this is supported on all browsers yet.
To prevent direct access to the images you should restrict the access to the images rather than trying to hide their URL.
To do this you can, for instance, modify your .htaccess file (a tool to generate an .htaccess file for this purpose can be found here).
In any case remember that the user can always (no matter what you do) save the images on his computer, you cannot prevent that, as the image is downloaded on the client when he visits your sites.
I'm displaying pieces of an image in a large grid created from divs. I'm using the background-image and background-position to display portions of the image. The problem I'm running in to is that a user can simply open up firebug and see the entire image (which defeats the purpose of the game).
I've attempted to mask the path using a php script as the URL but if the user navigates to the php file, they can still see the image. It would appear that anything I do with the CSS is entirely client side so denying everything outside the localhost in my .htaccess won't work.
Any suggestions?
The over arching goal is to have an automated way to split and display pieces of the image into a grid.
If you deliver the whole image to the browser, the browser holds the image and has every right to show it to a user. I don't think you can prevent the browser from showing it. I'm afraid you will have to deliver the image in pieces, or perhaps write your whole game using <canvas> and play around with images as pixel data. :)