Bilder mit Text in Extensions dynamisch erzeugen (GIFBuilder, PHP)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //get individual text for button:
  2. $buttontext=$this->pi_getLL('submit');
  3.  
  4. $buttonimage='fileadmin/images/blank_button.gif';
  5. $size=getimagesize($buttonimage); // get size of background-image
  6.  
  7. // define the whole Image
  8. $ts['img']='IMAGE'; //optional
  9. $ts['img.']['file']='GIFBUILDER';
  10. $ts['img.']['file.']['format']='gif';
  11. $ts['img.']['file.']['XY']=$size[0].','.$size[1]; // use original size
  12. $ts['img.']['file.']['altText']=$buttontext;
  13. $ts['img.']['file.']['titleText']=$buttontext;
  14.  
  15. // insert background-image
  16. $ts['img.']['file.']['1']='IMAGE';
  17. $ts['img.']['file.']['1.']['file']=$buttonimage;
  18.  
  19. // insert text
  20. $ts['img.']['file.']['10']='TEXT';
  21. $ts['img.']['file.']['10.']['text']=$buttontext;
  22. // style textappearance
  23. $ts['img.']['file.']['10.']['fontSize']='12';
  24. $ts['img.']['file.']['10.']['fontFile']='fileadmin/fonts/arial.ttf';
  25. $ts['img.']['file.']['10.']['fontColor']='#666666';
  26. $ts['img.']['file.']['10.']['offset']='22,14';
  27.  
  28. //render to img-tag:
  29. $img=$this->cObj->IMAGE($ts['img.']);

URL: http://www.pi-phi.de/rendering.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.