Php Jiugongge log

Source: Internet
Author: User
Php Jiugongge log
As required, you need to write text in nine tables. The title can be edited, with options for weather, background, and emoticon. Finally, an image is generated, which can be shared and saved to the database. Github Address: 9 Diary GitHub

  1. /**
  2. * Add logs
  3. * Bgid background image
  4. * Title log title
  5. * The Table title and content are separated by '-| * dt * |-' and are information in Tables 1, 2, 3, 4, 6, 7, 8, and 9.
  6. * Table 5: mid_title, emoticons
  7. * Template id: tempid, to be developed
  8. * Open: Privacy
  9. */
  10. // Dump ($ _ POST );
  11. $ Bgid = intval (htmlspecialchars ($ _ REQUEST ['bgid']);
  12. $ Title = htmlspecialchars ($ _ POST ['title']);
  13. $ Cnt = str_replace (PHP_EOL, '', $ _ POST ['cnt ']);
  14. // The title and content cannot be blank
  15. If (! Isset ($ title) |! Isset ($ cnt )){
  16. Echo 'Title and content cannot be blank! ';
  17. }
  18. $ Imgid = intval ($ _ POST ['imgid']);
  19. $ WeatherId = intval ($ _ POST ['atherid']);
  20. $ Mid_title = htmlspecialchars ($ _ POST ['mid _ title']);
  21. $ Cnt_titles = $ _ POST ['cnt _ titles '];
  22. $ TempId = intval ($ _ POST ['tempid']);
  23. $ Open = intval ($ _ POST ['open']);
  24. // Write the image
  25. Require_once ('appdiary. class. php ');
  26. $ Image = new AppDiary ();
  27. $ Path = dirname (_ FILE __);
  28. $ Backimage = $ path. '/images/preview/'.w.bgid.'.jpg ';
  29. $ Weatherimg = $ path. '/images/weather/'.w.weatherid.'.gif ';
  30. $ Emoticons_img = $ path. '/images/emoticons/'.w.imgid.'.gif ';
  31. $ Contents = explode ('-| * dt * |-', $ cnt );
  32. $ Contents_title = explode ('-| * dt * |-', $ cnt_titles );
  33. $ Str = array (
  34. Array ($ weatherimg, 528,1, 61,62), // weather
  35. Array ($ contents_title [0], 35,83, 146,28, 'cnt '), // Table 1 title
  36. Array ($ contents [0], 35,111,160,100, 'cnt _ titles '), // Table 1 content
  37. Array ($ contents_title [1], 222,83, 146,28, 'cnt '), // Table 2 title
  38. Array ($ contents [1], 222,111,160,100, 'cnt _ titles '), // Table 2 content
  39. Array ($ contents_title [2], 407,83, 146,28, 'cnt '), // Table 3 title
  40. Array ($ contents [2], 407,111,160,100, 'cnt _ titles '), // Table 3 content
  41. Array ($ contents_title [3], 35,244,146, 28, 'cnt '), // Table 4 title
  42. Array ($ contents [3], 35,273,160,100, 'cnt _ titles '), // Table 4 content
  43. Array ($ mid_title, 240,235,146, 38, 'mid _ title'), // table 5 title
  44. Array ($ emoticons_img, 261,283, 80), // table 5 content
  45. Array ($ contents_title [4], 407,244,146, 28, 'cnt '), // table 6 title
  46. Array ($ contents [4], 407,273,160,100, 'cnt _ titles '), // table 6 content
  47. Array ($ contents_title [5], 35,409,146, 28, 'cnt '), // table 7 title
  48. Array ($ contents [5], 35,436,160,100, 'cnt _ titles '), // table 7 content
  49. Array ($ contents_title [6], 221,409,146, 28, 'cnt '), // table 8 title
  50. Array ($ contents [6], 221,436,160,100, 'cnt _ titles '), // table 8 Content
  51. Array ($ contents_title [7], 407,409,146, 28, 'cnt '), // Table 9 title
  52. Array ($ contents [7], 407,436,160,100, 'cnt _ titles '), // table 9 Content
  53. );
  54. // Var_dump ($ str );
  55. $ Pic = $ image-> topaste ($ backimage, $ str );
  56. $ Filename = $ path. '/upfile/'. $ pic;
  57. // Add a time () to prevent the same file name
  58. $ Newname = $ title. '_'. time (). strrchr ($ pic ,'.');
  59. $ Newfile = $ path. '/upfile/'. $ newname;
  60. // It is mainly used for Chinese titles.
  61. $ Newfile = iconv ('utf-8', 'gb18030', $ newfile );
  62. If (file_exists ($ filename )){
  63. // The file name is successfully modified.
  64. If (rename ($ filename, $ newfile )){
  65. $ Pic = $ newname;
  66. }
  67. Echo json_encode (array ('info' => $ pic, 'status' => 1 ));
  68. } Else {
  69. // File generation failed
  70. Echo json_encode (array ('info' => 'error'. $ pic, 'status' => 0 ));
  71. }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.