What can php do with images?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
nick2
Forum Contributor
Posts: 118
Joined: Fri Jul 25, 2003 2:34 pm

What can php do with images?

Post 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
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

User avatar
nick2
Forum Contributor
Posts: 118
Joined: Fri Jul 25, 2003 2:34 pm

Post 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..
biz0r
Forum Newbie
Posts: 13
Joined: Mon Oct 27, 2003 3:21 pm
Location: Houston, TX

Post 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...
User avatar
nick2
Forum Contributor
Posts: 118
Joined: Fri Jul 25, 2003 2:34 pm

Post 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:
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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.
User avatar
nick2
Forum Contributor
Posts: 118
Joined: Fri Jul 25, 2003 2:34 pm

Post 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.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply