Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Combining picture with PHP

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
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
Close
any chance of the code for that?
 
0
Close
sure just a sec :)
 
0
Close
hi
thanks for replying :)
it appears you are interested aswell Joseph :p
hehe


Joe
 
0
Close
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
Close
thanks alot :)
this is perfect!

rep added
Joe
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back