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
- /**
- * Add logs
- * Bgid background image
- * Title log title
- * The Table title and content are separated by '-| * dt * |-' and are information in Tables 1, 2, 3, 4, 6, 7, 8, and 9.
- * Table 5: mid_title, emoticons
- * Template id: tempid, to be developed
- * Open: Privacy
- */
- // Dump ($ _ POST );
- $ Bgid = intval (htmlspecialchars ($ _ REQUEST ['bgid']);
- $ Title = htmlspecialchars ($ _ POST ['title']);
- $ Cnt = str_replace (PHP_EOL, '', $ _ POST ['cnt ']);
- // The title and content cannot be blank
- If (! Isset ($ title) |! Isset ($ cnt )){
- Echo 'Title and content cannot be blank! ';
- }
- $ Imgid = intval ($ _ POST ['imgid']);
- $ WeatherId = intval ($ _ POST ['atherid']);
- $ Mid_title = htmlspecialchars ($ _ POST ['mid _ title']);
- $ Cnt_titles = $ _ POST ['cnt _ titles '];
- $ TempId = intval ($ _ POST ['tempid']);
- $ Open = intval ($ _ POST ['open']);
- // Write the image
- Require_once ('appdiary. class. php ');
- $ Image = new AppDiary ();
- $ Path = dirname (_ FILE __);
- $ Backimage = $ path. '/images/preview/'.w.bgid.'.jpg ';
- $ Weatherimg = $ path. '/images/weather/'.w.weatherid.'.gif ';
- $ Emoticons_img = $ path. '/images/emoticons/'.w.imgid.'.gif ';
- $ Contents = explode ('-| * dt * |-', $ cnt );
- $ Contents_title = explode ('-| * dt * |-', $ cnt_titles );
- $ Str = array (
- Array ($ weatherimg, 528,1, 61,62), // weather
- Array ($ contents_title [0], 35,83, 146,28, 'cnt '), // Table 1 title
- Array ($ contents [0], 35,111,160,100, 'cnt _ titles '), // Table 1 content
- Array ($ contents_title [1], 222,83, 146,28, 'cnt '), // Table 2 title
- Array ($ contents [1], 222,111,160,100, 'cnt _ titles '), // Table 2 content
- Array ($ contents_title [2], 407,83, 146,28, 'cnt '), // Table 3 title
- Array ($ contents [2], 407,111,160,100, 'cnt _ titles '), // Table 3 content
- Array ($ contents_title [3], 35,244,146, 28, 'cnt '), // Table 4 title
- Array ($ contents [3], 35,273,160,100, 'cnt _ titles '), // Table 4 content
- Array ($ mid_title, 240,235,146, 38, 'mid _ title'), // table 5 title
- Array ($ emoticons_img, 261,283, 80), // table 5 content
- Array ($ contents_title [4], 407,244,146, 28, 'cnt '), // table 6 title
- Array ($ contents [4], 407,273,160,100, 'cnt _ titles '), // table 6 content
- Array ($ contents_title [5], 35,409,146, 28, 'cnt '), // table 7 title
- Array ($ contents [5], 35,436,160,100, 'cnt _ titles '), // table 7 content
- Array ($ contents_title [6], 221,409,146, 28, 'cnt '), // table 8 title
- Array ($ contents [6], 221,436,160,100, 'cnt _ titles '), // table 8 Content
- Array ($ contents_title [7], 407,409,146, 28, 'cnt '), // Table 9 title
- Array ($ contents [7], 407,436,160,100, 'cnt _ titles '), // table 9 Content
- );
- // Var_dump ($ str );
- $ Pic = $ image-> topaste ($ backimage, $ str );
- $ Filename = $ path. '/upfile/'. $ pic;
- // Add a time () to prevent the same file name
- $ Newname = $ title. '_'. time (). strrchr ($ pic ,'.');
- $ Newfile = $ path. '/upfile/'. $ newname;
- // It is mainly used for Chinese titles.
- $ Newfile = iconv ('utf-8', 'gb18030', $ newfile );
- If (file_exists ($ filename )){
- // The file name is successfully modified.
- If (rename ($ filename, $ newfile )){
- $ Pic = $ newname;
- }
- Echo json_encode (array ('info' => $ pic, 'status' => 1 ));
- } Else {
- // File generation failed
- Echo json_encode (array ('info' => 'error'. $ pic, 'status' => 0 ));
- }
|