Page 1 of 1

What can php do with images?

Posted: Mon Oct 27, 2003 2:15 pm
by nick2
Can php write text onto images and save?

Can it do any special effects to images.. like compressing.. adding a border...?


please help. 8O

Posted: Mon Oct 27, 2003 2:29 pm
by Cruzado_Mainfrm

Posted: Mon Oct 27, 2003 4:38 pm
by nick2
Could you maybe post an easy example I would understand on how to put text on a picture called test.jpg..

everytime I try I get errors..

Posted: Mon Oct 27, 2003 4:48 pm
by biz0r
Sounds like you want a ready made script...probably not going to get that here. A better idea would be to post the code you are using and all relevant error messages...then we can tell you what you might want to change, or point you towards the problem(s). That way you actually learn about what you are dealing with...

With that said...post the code and I'll see if I see any errors...

Posted: Mon Oct 27, 2003 5:04 pm
by nick2
no actually i'm not.. see I don't understand the code even thought I just read two of the tutorials.. I thought if someone made up some simple code and explained it I would understand.. if your just gonna post things and accusie me of asking ppl to script things for me.. then please don't post on my threads. :evil:

Posted: Mon Oct 27, 2003 5:30 pm
by Gen-ik
nick2 if you want an example of how to put text onto an image using GD then here it is......

Code: Select all

<?php
  header("Content-type: image/jpeg");
  $im = imagecreate(400,30);
  $white = imagecolorallocate($im, 255,255,255);
  $black = imagecolorallocate($im, 0,0,0);
  
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black, "/path/arial.ttf",
  "Testing... Omega: &#937;");
  imagejpeg($im);
  imagedestroy($im);
?>
........ but that doesn't help you does it??

As m2rajk said, show us the code you are using and we can help you with the errors you're getting, and it may help you to understand what's going on a bit better.

Posted: Mon Oct 27, 2003 7:27 pm
by nick2
lol... if more knowlgeable people know more then I do and if i've been sitting here for an hour chaning the code around to get it to work.. I shouldn't ask so I can have a simple solution to my problem in 5 minutes?

get your facts right.

edit: also that discussion was no help to me at all I waited an hour for a response then finally someone responded with a post about that which I already understood.. I wanted to move on .. i'm sure everyone would of felt the same.

Posted: Mon Oct 27, 2003 8:37 pm
by qads
number 1 rule of this forum is that you show other users that you have tried on your own first, it is very rare that someone will post a full working code, which would be pointless since everyone is here to learn, not copy & paste lines of code.

Posted: Mon Oct 27, 2003 9:33 pm
by JAM
nick2 wrote:Could you maybe post an easy example I would understand on how to put text on a picture called test.jpg..

everytime I try I get errors..
nick2 wrote:anyway the whole point of this forum is for questions or am I mistaken?
Some tips.
If you get errors (as stated, quoted above), show it to us. Yes, the biggest point of the board is to ask questions, if you do it in a good way.

viewtopic.php?t=8815
If you read this thread (mainly point 6, 8 and 11) you would get a hang of it.

We cant answer a question by guessing among 24 different possabilites of errors, 3 major php versions, and misc other configurations. Keep asking questions, but put some thought in them before pressing the submit button and you'll get results from the answers as well.

Happy coding.

Posted: Tue Oct 28, 2003 5:32 am
by twigletmac
I have trimmed this thread somewhat in the hope that it might be able to get back on track, if anyone has issues with what I have done please PM me directly.

The main reason I have taken this action is because the question was valid but it was heading steadily towards a flame war. Pointing users towards the posting guidelines is important when you are telling them they are doing something wrong. If you don't want to help a particular user, don't, ignore their threads if they irritate you, don't flame them.

On the flip side, if you're trying to do something and your code is failing, show us your code and post any error messages. If what you want is an explanation of how a piece of code works, post the code and ask about the specific bits, don't then get upset if you get sent straight to the manual, it generally does hold most of the answers.

In summary, try not to turn threads into flame wars, PM me or another admin or mod if you are unhappy with a user and it looks like a topic is getting out of hand. Don't post in threads if it's only to flame and always show us that you've tried with your code. Then we will all be much happier :). Flame wars scare off new users as do hostile regulars and we really want these forums to grow.

Thanks,
Mac