Chat room Technology (7) -- Post fig _ PHP-php Tutorial

Source: Internet
Author: User
Pull $ split2 $ split black $ splitxw2 add some beautiful pictures in the chat text .......

The image code is generated in the same way as the emoticons. you can select the menu or manually enter the image code. here, only the format and code are provided, and no explanation is given. check the emoticons in the action section.

1 File format

// $ Picturefilename

1$splitcoffee West server ?splitxw20151.jpg $ split
2$splitblack $$splitxw201534.jpg $ split

Number + name + image name +

2 Programs

In my chat room, the image is displayed by // gift + number. Note that there are three backslashes, which are different from emoticons.


<?
// Determine whether the first 7 characters in the speech are /// gift
If (substr ($ message, 0, 7) = "// gift ")
{

// Obtain the image number, which is a string of 2 characters starting from 7th characters (note: The character number starts from 0)
$ Id = substr ($ message, 7,2)-1;

// Read the image file
$ Giftmsg = file ($ picturefilename );

// Determine whether the serial number is valid
If ($ id> = 0) & ($ id <count ($ giftmsg )))
{
// Split the image rows
$ Gift = split ($ split, $ giftmsg [$ id], 99 );

// Generate the image's speech content
$ Message = "<a href = javascript: parent. cs ('$ name') target = d> <font col
Or = $ namecolor> $ name </font> </a> to <a href = javascript: parent. cs ('$ talkt
O ') target = d> $ talkto </a> a $ gift [1] 0 height = 60 border = 0> </font> ";

// Mark of successful image generation
$ Specialsign = 1;
}

}


Is it easy? Don't try it now !!

Original Author: howtodo
Source: php2000.com

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.