![]() |
Image manipulation
Found this link on the web: http://www.ryano.net/iraq/
It allows you to enter some text that when submitted becomes part of the image (if you right click and save - the text is within the image). Anyone know how they do it or can point me in the direction of site that shows me how. I would like to create a similar function for one of my websites. Thanks in advance... |
Re: Image manipulation
I've already written something similiar. I was writing it so I can have a random generated sig on this board. It basically works, but I still want to tweak the text position/alignment but anyway, here is the important code:
Code:
To call it, include this in your HTML file: Code:
<img src="imagemanipulated.php"></img>HTH |
Re: Image manipulation
Thanks for your help it would appear that I-WEB don't support TTF ...
"Call to undefined function: imagettftext()" O well back to the drawing board!!! |
Re: Image manipulation
You need the GD and FreeType library. I'd ask them to add it, although they should have by default. Give KingPhoenix a nudge.
If he won't, I might have to start renting out my PHP server :) On the brightside it might be 400k upload soon :) |
Re: Image manipulation
I-web has the latest GD library, I use it regularly, not sure about Freetype though.
|
Re: Image manipulation
If it is running, it should say, under the GD section of phpinfo():
GD Support enabled FreeType Support enabled |
Re: Image manipulation
Now running on both I-WEB servers - Top marks to KP.
|
Re: Image manipulation
Punky, that script works well, though, I've managed to **** it up already, I've got a form which you slap the text in and it uses GET to send the URL string e.g. www.blah.com/content=whatevertextstring then the php file I've altered to use:
$thestring = $_GET["content"]; It just seem's to put odd characters up, must be something to do with it not reading it as a text field or something. (also, is there any way of centering the text horizontally on the image?) |
Re: Image manipulation
Quote:
|
Re: Image manipulation
I don't know what you are doing wrong as it works here. If you get funny symbols in there, like squares, you may be using symbols that aren't in the font set. Make sure, for the moment, you only use alphanumeric characters.
Without looking at the code, it is hard to see what you are doing, but here is what you should have, if you want to set the text via a form: Code:
Code:
For centring the text: This isn't the most concise way, but it is the way that makes it easiest to understand. Replace the imagettftext line with this: Code:
Just as a helpful reference, here is the whole of my code: Code:
<?phpFile: callimagemunip.php Code:
<html> |
Re: Image manipulation
I'd use a slightly different version:
PHP Code:
It says something like "if content is not empty then do this, otherwise echo the form out". |
Re: Image manipulation
Ah now that works ok, all I have to do now is stop it antialiasing so I can use 9 point verdana.
http://www.se-an.co.uk/test.php I'm sure there's a setantialias command, but I can't find any reference to it from google. |
Re: Image manipulation
You can turn it off using:
http://uk.php.net/manual/en/function.imageantialias.php just use imageantialias($im,false); |
Re: Image manipulation
Quote:
If you stick a "-" in from the the $textcolor it seems to take some of the antialiasing off. |
Re: Image manipulation
phpinfo indicates:
GD Support enabled FreeType Support enabled yet line 24 (using Punky's whole of code post) $bounds = imagettfbbox(12,0,'arial.ttf',$thestring); errors with Warning: Could not find/open font in /home/my_account/public_html/pix/pix.php on line 24 and arial.ttf is in the same folder as pix.php Any ideas why the error as I have tried it as $bounds = imagettfbbox(12,0,'arial.ttf',$thestring); and $bounds = imagettfbbox(12,0,'/home/my_account/public_html/pix/arial.ttf',$thestring); wuth the same error?! |
| All times are GMT. The time now is 12:39. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum