youknowho Posted October 21, 2008 Share Posted October 21, 2008 I am successfully watermarking images with imagestring, but have yet to get the copyright symbol to appear correctly. I've tried htmlspecialchars_decode: $copyString = htmlspecialchars_decode('©', ENT_QUOTES) . date(Y) . ' My Company'; imagestring($image, 3, 80, 475, $copyString, $black); I've also tried html_entity_decode: $copyString = html_entity_decode("©") . date(Y) . ' My Company'; imagestring($image, 3, 80, 475, $copyString, $black); which according to http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23295622.html works, but not for me. I also set default_charset = "iso-8859-1" in php.ini on the chance that a different charset was being used for some reason. No matter what I try I get an "A" or "S" with markings above it (which I think are coming from another character set). Ideas? Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 21, 2008 Share Posted October 21, 2008 Perhaps chr(169); ? Quote Link to comment Share on other sites More sharing options...
youknowho Posted October 21, 2008 Author Share Posted October 21, 2008 Thanks for the reply. I forgot to mention that I tried that yesterday as well. I get the same "S" with a mark over it, which makes me think it is a character set/encoding issue. Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 21, 2008 Share Posted October 21, 2008 Or possibly font issue. Quote Link to comment Share on other sites More sharing options...
youknowho Posted October 21, 2008 Author Share Posted October 21, 2008 Geeze it is a font issue thank you. I assumed imagestring would support the copyright symbol but it doesn't. When I try: imagefttext ($image, 15, 0, 160, 485, $black, '/usr/.../fonts/LucidaSansDemiBold.ttf', chr(169) . date(Y) . ' My Company'); it works fine. I was hoping to use imagestring because the freetype text looks really pixelated/muddled (even with png output). I've seen an Imagemagick solution but don't know if it's installed on the host. All I want is a clear copyright notice on my image! Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 21, 2008 Share Posted October 21, 2008 I don't think it's the function... it's more than likely the font you've used IN the function. You're going to have to grab a gdf font that contains the copyright symbol in order to do it. Alternately, use a TTF font! <?php $im = imagecreate( 80,50 ); $bg = imagecolorallocate( $im, 255, 255, 255 ); $txt = imagecolorallocate( $im, 0, 0, 0 ); imagettftext( $im, 12, 0, 15, 30, $txt, 'C:/windows/fonts/arial.ttf', chr(169).' 2008' ); header('Content-type: image/png'); imagepng($im); ?> Quote Link to comment Share on other sites More sharing options...
youknowho Posted October 22, 2008 Author Share Posted October 22, 2008 I can use true type fonts with imagettftext and imagefttext but as I mentioned, the quality is horrible. I made an arial gdf font and it looks equally bad. I did notice in the imagestring documentation that the encoding is latin2, so I'm going to work on changing that for the string printed to the image. Thanks. Quote Link to comment Share on other sites More sharing options...
youknowho Posted October 22, 2008 Author Share Posted October 22, 2008 After more testing, creating a gdf font with a lot of experimentation to find its' sweet spot for size and character width, used with imagestring worked. Thanks again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.