I'm searching for a class or function, to convert, add borders and text (using ttf fonts) to an uploaded image before the image is saved on the server. Do you know something?
If you can use ImageMagick, go for it. It handles TTF rendering way better than plain GD.
Pekka
2009-11-14 19:21:46
+1
A:
You could try the GD library.
You can convert image types using the imagecreatefromjpeg
/png
/gif
and imagejpeg
/png
/gif
functions.
imagerectangle
for adding a border (draw a rectangle behind your image).
imagettftext
for adding text.
Lots of tutorials online, good luck!
Richard Nguyen
2009-11-14 15:24:57
Basically, if the tool of your choice manages to open a file and add a watermark to it, you can safely assume that it is a valid image. As long as you use move_uploaded_file() and consorts, there are no specific security risks that come to mind.
Pekka
2009-11-14 19:26:15