I have a website textscloud.com In this website i make the image with the PHP GD library. Here is a link to a demo:
In this page i allow the user to download the image on which text will pe printed. download link is like
This download.php file has a header for making the image with PHP GD Library and download the file like this
header("Content-type: image/png");
But google didn't crawl these images. Does anyone know the solution? I can't store these image in server.
You don't mention how you are feeding the beast, so I suggest you start by providing google a site map via their webmaster toolkit. You can specifically list the images that you want crawled. Google provides good help articles to get you going.
Google can't index images that are not stored permanently, I'm quite sure it can't even index images without context (i.e. which are not part of a describing/linking page).
You can try to:
Send a cache header to allow caching of the image.
Rewrite the actual url to someting like: http://textscloud.com/get_img/download/VkZaU1FtUXdNVVZWVkZKT1ZWUXdPUT09.png (should match your filename header)
Related
I want to output a file from Dropbox onto my website with Dropbox PHP Core SDK. To give an example, I upload an image to Dropbox. Now, how do I display that image to my website from Dropbox's servers. Keep in mind, I don't want to download this file from Dropbox and then display that image. Is it possible to display an image or another file directly from Dropbox using Dropbox PHP Core SDK?
EDIT:Would you mind being more clear on #1
How do I use the custom URL?
Can I do this: header("location: $url);
Is this how you use the custom url? Thanks!
Using the PHP Core SDK, the main way of accessing file content is using the getFile method, or for images where you don't need the full resolution, the getThumbnail method. However, these return the data directly, e.g., to save on your server and serve back to the user, so that doesn't suit your needs as described.
It sounds like you'd prefer the API to return a link to the image that you can use as the source for the images in the HTML of your page. The Dropbox API doesn't offer a method particularly well suited for that, but there are some non-ideal options:
1) You can use createTemporaryDirectLink to get a direct URL to the image. Note that these links expire after four hours though.
Using it would look like:
list($url, $expires) = $client->createTemporaryDirectLink("/default.png");
2) You can use createShareableLink to get a preview URL for the image. These links don't expire. Note that these don't link directly to the image data though, so you'd need to modify them as documented in this help article.
Using it would look like:
$url = $client->createShareableLink("/default.png");
Also, not that both of these are subject to bandwidth restrictions, per this help article.
Is it possible to put PHP code into raw images?
For example:
http://gifsec.com/wp-content/uploads/GIF/2014/05/GIF-When-white-guys-dance.gif
If you go to that url you'll just see the raw image on a white page. Is it possible to somehow put code into this raw page? For example, you may want to put Google analytics tracking into raw image files so you can track people on reddit sharing raw files.
Not that I know of, what you may want to consider is having people share the link to that file so they can download it and then put code into the page that link redirects to that tracks or counts visitors. Tracking the visitor is harder and leads into ethical issues, so I would just set up google analytics and put their code into that page.
No,
http://gifsec.com/wp-content/uploads/GIF/2014/05/GIF-When-white-guys-dance.gif
is a resource on your server. that URL simply directs the browser to where the image is stored on the server.
to achieve what you want. simply create a page and include the image into
http://gifsec.com/GIF-When-white-guys-dance
<img src=''> on this page you can then add your Google analytic code.
Images are transferred from server to browser with binary encoding. this is why it will not work how you are thinking
You can hide anything you want in an image file. This is called steganography. The problem is that the code won't be executed unless it's uploaded to a server that is specifically set up to extract and run it.
It's not silly, just difficult. What you would have to do is use a PHP script to process it back. As such, your dance.gif would become dance.php and you would link to that. It will add some overhead to your server to do this so just be aware, however, this would allow you to track it via PHP. You could then import that data into Google Analytics at a later date.
Here's some pseudo code (we'll call this dance.php)
<?php
//Insert some tracking here, like a Database INSERT statement
$img = imagecreatefromgif('/path/to/dance.gif');
header('Content-Type: image/gif');
imagegif($image);
imagedestroy($image);
Then in your HTML
<img src="dance.php">
What you need is called pixel tracking also called web bug.
Take a look at this answer:
https://stackoverflow.com/a/13079838/797495
I was looking at an possibly fraudulent eBay auction. However I am confused by an image within it, since it does not appear to be an image.
youneedtobuy.intothis.org/win.php
The complete HTML content of the url above is:
<body>
<img src="http://youneedtobuy.intothis.org/win.php" >
</body>
Here is a screen copy of the image, with the email address blurred out by me. There is no JS scripting, no CSS to speak of, just one line of code.
So, essentially the scammer can insert an 'image' into their eBay ad, and that image won't be scanned by normal tools.
How is this image created? And how could the friendly folks at ebay include a scanner in their system that has the ability to "see" this image (and preclude the scam from re-occurring?)
The image is likely created using PHP's file_get_contents() function. For example, the following PHP script will display the contents of myimage.jpg to the browser, but the file could be called show-image.php:
<?php
header("Content-Type: image/jpeg");
header("Content-Length: ".(string)(filesize('myimage.jpg')));
echo file_get_contents('myimage.jpg');
?>
As you can see, this is achieved by telling PHP to serve up the image/jpeg MIME type.
Any image can be returned by a script instead of a real file.
An alternative answer shows methods of doing this, but by using a script one can serve different images to different users, log IP address and other information thus tracking viewers etc.
It is also a common technique used to return thumbnail or summary images. e.g. using PHP and ImageMagick to generate an image of the first page of a PDF file.
Incidentally the image will be scanned by normal tools - they simply look for the image tags, not what extension the file has. What you are really saying is that the text contained within the image won't be processed or analysed, and the image does invite you to directly connect to someone, which is against eBays terms and conditions.
I'm currently trying to deliver MP4 video for use in HTML5 video (using video-js) via a PHP script for controlling video access. After some research I was able to get this working, with the help of the stackoverflow article found here. If I navigate to the PHP script, I can view the video as if I were viewing it via its absolute path (for instance localhost/myvideo.mp4 rather than localhost/myscript.php) in Firefox, Safari and IE. My problem is with Google Chrome, which simply shows a blacked out screen with a small media player in the centre, and does nothing.
I did try using a quick rewrite such as localhost/avideo.mp4 which routes to the PHP script, but unfortunately this didn't change anything.
Here's my script:
if (is_file($uri)) {
header('Content-Type: video/mp4');
if (isset($_SERVER['HTTP_RANGE'])) {
$this->rangeDownload($uri);
exit;
} else {
header("Content-Length: ".filesize($uri));
$this->readfile_chunked($uri);
exit;
}
} else {
//error
}
The rangeDownload method has been taken directly from appendix A of this link as suggested in the aforementioned stackoverflow article.
Maybe the problem is with the URL (more specifically, the extension). Normally, you would use Content-Disposition header, but I understand that this is not desirable when delivering content to mobiles.
Try using localhost/myscript.php/myvideo.mp4
It is important not to use the "Content-Disposition" HTTP header, since some phones refuse to accept content when using it.
By including the filename on the URL, you will trick the phone to think it's a real file and to accept it.
Now, when you send the download URL to the customer, you don't normally know yet what device the customer has, so you don't know what file formats the device will support. Therefore, you can't include the filename on that URL, and once again, you will need an intermediate download page. Once more, we will use a URL like:
http://wap.mydomain.tld/get.php/123456abcdef
This time, when the customer connects to download the content, the get.php script will not create a temporary file, but point to another script which streams the file contents.
Supposing the resultant content to download will be "image.jpg", the intermediate download page could point the customer to a URL like:
http://wap.mydomain.tld/download.php/123456abcdef/image.jpg
From ( http://mobiforge.com/developing/story/content-delivery-mobile-devices )
I understand you're using video-js but I recommend using html5media (also check out the github page for more info). I had to make videos available on a website for work and I tried a few things including video-js but html5media was the only one that I could get working in all browsers.
A side note that might help others: One of the requirements was that we hosted all files so that we wouldn't be reliant on third-party servers to serve JavaScript files or flash players, I can't remember if with video-js this was easy but I know with html5media we were able to download flowplayer and have everything on our servers.
And to generate the 3 recommend video formats (mp4, WebM and Theora) I used Miro Video Converter
For some security reasons, I would like to generate an image based on Google Calendar embed iframe, to be able to show it on a website who don't allow iframes.
Is there any php library to create an image from html?
The script have to be executable on a linux server.
The library wkhtmltoimage works perfectly.
I have created a page to embed the google calendar (the url can't be reach directly).
I generate a picture from this page and I link this image on my profile on the website.
Thanks heaps for the comments.
functions from the GD library to output an image of the current screen
<?php
//All of your normal code would go here
//But before exiting, grab a snapshot
$image = imagegrabscreen();
imagejpeg($image,"my_screenshot.jpeg");
imagedestroy($image);
?>
Or use
websnapr lets you capture screenshots of (almost) any web page. Allow your visitors to instantly visualize any web page before clicking. Increase site traffic, click-through rate and site stickiness.