Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Combining picture with PHP

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Spacemail by SpaceshipSpacemail by Spaceship
Watch

Joe

VIP Member
Impact
48
Hi
i am wondering if there is a way to combine a picture and php or javascript?

so someone can copy a piece of code e.g.
Code:
<a href="http://mysite.com"><img src="TheImage.ext"></a>
or w/e
and it has the image
and above the image is like a countdown script, or a time script

thanks alot

Joe
 
Last edited:
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
you can with php but not with js :)

i did some with php in here -> http://www.assaultcms.com/sign/2.jpg

result

2.jpg
 
0
•••
any chance of the code for that?
 
0
•••
sure just a sec :)
 
0
•••
hi
thanks for replying :)
it appears you are interested aswell Joseph :p
hehe


Joe
 
0
•••
Ok here's the small tutorial

1.Ensure that gd is activ. Usually php comes with the gd extension preinstalled. Search in php.ini for ;extension=php_gd2.dll, if you find it remove the ";", save it and restart apache. If php doesn't have the gd extension preinstalled please view the imagemagick site http://www.imagemagick.com/(vezi instructiunile de instalare).

2.We make a small image template in my case ( see bellow )
117template.jpg


3.We chose a font ( we need the .ttf file)

4.The php code(see bellow)
PHP:
<?php
	
	//
	//We set the headers
	//
	
	Header('Content-type: image/jpeg');
	Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
	Header('Expires: Thu, 19 Nov 1977 01:12:00 GMT');
	Header('Pragma: no-cache');
	
	//
	//What the browser ?!
	//
	
	function browser($browser_def){
	if (!(strpos($browser_def,'Mozilla') === false)){
		if (!(strpos($browser_def,'Opera') === false)) $browser = 'Opera';
			elseif (!(strpos($browser_def,'Firefox') === false)) $browser = 'Firefox';
			elseif (!(strpos($browser_def,'Netscape') === false)) $browser = 'Netscape';
			elseif (!(strpos($browser_def,'MSIE') === false)) $browser = 'IE';
			else $browser = 'Unknow';
		}
	return $browser;
	}
	
	//
	//We create a image from the image template
	//
	
	$image = imagecreatefromjpeg("template.jpeg");
	
	//
	//Font color
	//
	
	$font_color = imagecolorallocate($im, 203, 203, 203);
	
	//
	//Path to font
	//
	
	$font = 'Font.TTF';
	
	//
	//Set the ip
	//
	
	$ip = $REMOTE_ADDR;
	
	//
	//Scriem ip-ul pe imagine
	//
	
	ImageTTFText($image, 12,0, 38,73, $font_color , $font, $ip);
	
	//
	//Call for browser function
	//
	
	$browser = browser($_SERVER['HTTP_USER_AGENT']);
	
	//
	//Write the browser to image
	//
	
	ImageTTFText($image, 12,0, 80,48, $font_color , $font, $browser);
	
	//
	//Show image
	// 
	
	imagepng($image);
	
	//
	//We destroy the image
	//
	
	imagedestroy($image);
?>

5. We create an .htaccess file and we insert the text bellow
Code:
ForceType application/x-httpd-php

6.We copy the .htaccess in the same place with the php file

Note: you can change the extension from .php to .jpeg if you want to add it to your sig etc ;)

We should have as a result (see bellow)

Note: if you find this usefull you can add me some rep :hehe:
 
Last edited:
6
•••
thanks alot :)
this is perfect!

rep added
Joe
 
0
•••
CatchedCatched

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

Parking: find your domains by pasting a list
You can now paste a list of domain names into the search box at the top of the Parking menu. Put one name on each line. Your domain list...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back