Solved Text on signs

Discussion in 'Plugin Requests' started by Sedate, May 18, 2015.

  1. I have yet to find a plugin that allows this or the capability to do so in game already .. Any way someone can add a text field for signs?
     
  2. Players want to be able to place text on the signs again. So...

    Does anyone think it's possible to create a plugin that IN COMBINATION with a web server using something like ImageMagik or something could:
    • Allow a player to type a message that is then sent the message to the web server to create the PNG file and host it
    • The plugin would then use methods from the SignArtist plugin to automatically place it on the sign in front of the player.
    OR

    Is there a way for a plugin to create the PNG on the fly, store it and put that image on the sign.
     
    Last edited by a moderator: Oct 20, 2015
  3. Use PHP to generate and output the image dynamically
     
  4. Right. A server owner could make use of their web server to make this plugin work. Some PHP like:
    Code:
    <?php
    // Set the content-type
    header('Content-type: image/png');// Create the image
    $im = imagecreatetruecolor(400, 30);// Create some colors
    $white = imagecolorallocate($im, 255, 255, 255);
    $grey = imagecolorallocate($im, 128, 128, 128);
    $black = imagecolorallocate($im, 0, 0, 0);
    imagefilledrectangle($im, 0, 0, 399, 29, $white);// The text to draw
    $text = 'Testing...';
    // Replace path by your own font path
    $font = 'arial.ttf';// Add some shadow to the text
    imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);// Add the text
    imagettftext($im, 20, 0, 10, 20, $black, $font, $text);// Using imagepng() results in clearer text compared with imagejpeg()
    imagepng($im);
    imagedestroy($im);
    ?> 
    The font used could be selected in the plugin by the player. Have like 5 - 10 selectable fonts.
     
  5. Wulf

    Wulf Community Admin

  6. Cool Norn ! Anyway to use "\n" for carriage returns?