CN110855553A - Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) - Google Patents
Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) Download PDFInfo
- Publication number
- CN110855553A CN110855553A CN201911065989.3A CN201911065989A CN110855553A CN 110855553 A CN110855553 A CN 110855553A CN 201911065989 A CN201911065989 A CN 201911065989A CN 110855553 A CN110855553 A CN 110855553A
- Authority
- CN
- China
- Prior art keywords
- picture
- address
- server
- message
- size
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/07—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail characterised by the inclusion of specific contents
- H04L51/10—Multimedia information
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention provides an XMPP protocol-based picture transmission method, which comprises the following steps: 1) the sending terminal selects a local picture to send, and displays the picture in the chat list according to the local address; 2) the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture; 3) after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message; 4) after receiving the message body, the receiving party analyzes the server address of the obtained picture and the corresponding picture size, and downloads the picture in the message list according to the address for display. The invention reduces the size of the message body of the sent message, only adds the file server end address of the picture, namely the cloud end address, in the message body, and does not need to directly put binary data into the message body, thereby reducing the probability of sending failure.
Description
Technical Field
The invention belongs to the technical field of instant messaging, and particularly relates to an XMPP protocol-based picture transmission method and device.
Background
With the continuous development of the mobile internet and the continuous improvement of the living standard, instant messaging (instant messaging) is becoming one of the mainstream communication modes. As an indispensable part in IM, sending and sharing of pictures occupy a large part, so a good picture transmission method and a good picture storage method are necessary, and user experience of a user in a chat process can be effectively improved.
After the picture is compressed in a certain proportion, the binary data stream of the picture is directly encapsulated in a message body as a field attribute and sent out, and after a receiver receives the message, the picture is displayed by acquiring the binary data stream.
The direct transmission of a binary data stream may result in an excessive amount of data and a transmission failure. Meanwhile, after receiving the message, the receiving party can only display the picture through the data stream, and cannot switch between the original picture and the thumbnail, which sometimes wastes traffic and time.
Disclosure of Invention
In view of this, the present invention aims to provide an XMPP protocol-based picture transmission method and apparatus, which reduces the size of a message body for sending a message, and transmits a picture by sending a picture cloud address, thereby avoiding the problem of sending too large data.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
in one aspect, the present invention provides an XMPP protocol-based picture transmission method applied to a terminal, where the method includes the following steps:
1) the sending terminal selects a local picture to send, a local path of the picture appears, and the sending terminal displays the picture in the chat list according to the local address;
2) the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture;
3) after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message;
4) after receiving the message body, the receiving party analyzes the server address of the obtained picture and the corresponding picture size, and downloads the picture in the message list according to the address for display.
Further, after the uploading in the step 2) is successful, receiving a server address of the picture returned by the file server and a server address of the thumbnail generated by the file server, wherein the server addresses carry the sizes of the picture and the thumbnail; and 6), analyzing and acquiring the original image or the thumbnail address of the picture and the corresponding picture size.
Further, the message body in the step 3) is sent in a JSON format.
On the other hand, the invention provides an XMPP protocol-based picture transmission terminal, when the terminal is used as a sending terminal, the sending terminal selects a local picture to send, a local path of the picture appears, and the sending terminal displays the picture in a chat list according to a local address; the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture; after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message;
when the terminal serves as a receiving end, after the receiving end receives the message body, the server address of the picture and the corresponding picture size are obtained through analysis, and the picture is downloaded in the message list according to the address and displayed.
Further, after the sending end successfully uploads, the server address of the picture returned by the file server and the server address of the thumbnail generated by the file server are received, and the server address carries the sizes of the picture and the thumbnail; and the receiving end obtains the original image or the thumbnail address of the picture and the corresponding picture size through analysis.
Compared with the prior art, the method and the terminal have the following advantages that:
(1) the invention reduces the size of the message body of the sent message, only adds the file server end address of the picture, namely the cloud end address, in the message body, and does not need to directly put binary data into the message body, thereby reducing the probability of sending failure.
(2) The invention saves the pictures in the cloud, is relatively independent from the message body and is more beneficial to management. The mobile terminal can also select and view the thumbnail or the original image more conveniently.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate an embodiment of the invention and, together with the description, serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a processing flow diagram of a sending end according to an embodiment of the present invention;
fig. 2 is a flowchart of processing at the receiving end according to the embodiment of the present invention.
Detailed Description
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict.
The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
The invention relates to an XMPP protocol-based picture transmission method, as shown in figures 1 and 2, comprising the following steps:
1) the sending end selects a local picture to send, a local path of the picture appears, a local address of the picture is stored in a local database, the sending end displays the picture in a chat list according to the local address, and the sending state is the starting sending state;
2) the method comprises the steps that a picture at a sending end starts to be uploaded to a file server, and after the picture is uploaded successfully, a server address of the picture returned by the file server is received and carries the size of the picture;
3) after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the address and the size of the corresponding picture into a message body, and meanwhile, the message body has attributes to mark the message type as a picture, and sends the message, and the message body is sent in a JSON format; if the sending fails, the sending button is clicked again, and the sending state of the local database is updated to be failed; if the transmission is successful, the transmitting end displays a successful transmission state and updates the transmission state of the local database to be successful;
4) after receiving the message body, the receiver stores the message body in a local database, and marks the receiving state as receiving; the server address of the picture and the corresponding picture size are obtained through analysis, the picture is downloaded in a message list according to the address, and if the downloading fails, a occupation map is displayed; if the downloading is successful, the local address of the picture is packaged into the message body, the local database is updated, and the receiving end displays the picture.
After the successful uploading in the step 2), receiving the server address of the thumbnail of the picture generated by the server, the server address of the original picture returned by the server and the corresponding picture size; and 6), analyzing and acquiring the original image or the thumbnail address of the picture and the corresponding picture size. The method and the device for generating the thumbnail at the server end can effectively reduce consumption of the mobile end, and avoid the situation that when the thumbnail is generated at the mobile end, the thumbnail and the original image need to be respectively transmitted to the file server during uploading, so that the returned addresses are also returned one by one, and the operation on the database is increased.
According to the picture transmission terminal based on the XMPP, when the terminal serves as a sending terminal, the sending terminal selects a local picture to send, a local path of the picture appears, and the sending terminal displays the picture in a chat list according to a local address; the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture; after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message;
when the terminal serves as a receiving end, after the receiving end receives the message body, the server address of the picture and the corresponding picture size are obtained through analysis, and the picture is downloaded in the message list according to the address and displayed.
For another preferred embodiment of the terminal device, after the uploading at the sending end is successful, the server address of the picture returned by the file server and the server address of the thumbnail generated by the file server are received, and the server addresses carry the sizes of the picture and the thumbnail; and the receiving end obtains the original image or the thumbnail address of the picture and the corresponding picture size through analysis.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (5)
1. An XMPP protocol-based picture transmission method is applied to a terminal, and comprises the following steps:
1) the sending terminal selects a local picture to send, a local path of the picture appears, and the sending terminal displays the picture in the chat list according to the local address;
2) the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture;
3) after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message;
4) after receiving the message body, the receiving party analyzes the server address of the obtained picture and the corresponding picture size, and downloads the picture in the message list according to the address for display.
2. The XMPP protocol-based picture transmission method according to claim 1, wherein: step 2) after the uploading is successful, receiving the server address of the picture returned by the file server and the server address of the thumbnail generated by the file server, wherein the server address carries the sizes of the picture and the thumbnail;
and 6), analyzing and acquiring the original image or the thumbnail address of the picture and the corresponding picture size.
3. The XMPP protocol-based picture transmission method according to claim 1, wherein: and 3) sending the message body in a JSON format.
4. An XMPP protocol-based picture transmission terminal is characterized in that,
when the terminal is used as a sending end, the sending end selects a local picture to send, a local path of the picture appears, and the sending end displays the picture in a chat list according to a local address; the sending end uploads the picture to the file server, and after uploading is successful, the sending end receives a server address of the picture returned by the file server and carries the size of the picture; after acquiring the address of the server and the size of the corresponding picture, the sending end encapsulates the server into a message body, and meanwhile, the message body has attributes to indicate that the message type is a picture, and sends the message;
when the terminal serves as a receiving end, after the receiving end receives the message body, the server address of the picture and the corresponding picture size are obtained through analysis, and the picture is downloaded in the message list according to the address and displayed.
5. The XMPP protocol-based picture transmission terminal of claim 4, wherein: after the sending end uploads successfully, the server address of the picture returned by the file server and the server address of the thumbnail generated by the file server are received, and the server address carries the sizes of the picture and the thumbnail; and the receiving end obtains the original image or the thumbnail address of the picture and the corresponding picture size through analysis.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911065989.3A CN110855553A (en) | 2019-11-04 | 2019-11-04 | Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911065989.3A CN110855553A (en) | 2019-11-04 | 2019-11-04 | Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110855553A true CN110855553A (en) | 2020-02-28 |
Family
ID=69599038
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911065989.3A Pending CN110855553A (en) | 2019-11-04 | 2019-11-04 | Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110855553A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060277477A1 (en) * | 2005-06-02 | 2006-12-07 | Christenson Mark G K | System and method for generating enhanced depiction of electronic files such as web files |
CN101193074A (en) * | 2007-05-22 | 2008-06-04 | 腾讯科技(深圳)有限公司 | A method and system for display image on instant communication demonstration frame |
KR20120085586A (en) * | 2011-01-24 | 2012-08-01 | 쿠도커뮤니케이션 주식회사 | Apparatus and method for providing section of video |
CN104967551A (en) * | 2014-08-06 | 2015-10-07 | 腾讯科技(深圳)有限公司 | Method for picture transmission interaction, related equipment thereof, and communication system |
CN107306219A (en) * | 2016-04-21 | 2017-10-31 | 上海神计信息系统工程有限公司 | Picture transmission method and device in instant messaging |
-
2019
- 2019-11-04 CN CN201911065989.3A patent/CN110855553A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060277477A1 (en) * | 2005-06-02 | 2006-12-07 | Christenson Mark G K | System and method for generating enhanced depiction of electronic files such as web files |
CN101193074A (en) * | 2007-05-22 | 2008-06-04 | 腾讯科技(深圳)有限公司 | A method and system for display image on instant communication demonstration frame |
KR20120085586A (en) * | 2011-01-24 | 2012-08-01 | 쿠도커뮤니케이션 주식회사 | Apparatus and method for providing section of video |
CN104967551A (en) * | 2014-08-06 | 2015-10-07 | 腾讯科技(深圳)有限公司 | Method for picture transmission interaction, related equipment thereof, and communication system |
CN107306219A (en) * | 2016-04-21 | 2017-10-31 | 上海神计信息系统工程有限公司 | Picture transmission method and device in instant messaging |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP1653693B1 (en) | File transmission method in instant messaging service | |
CN106789562B (en) | Virtual article sending method, virtual article receiving method, virtual article sending device, virtual article receiving device and virtual article sending system | |
CN103069755B (en) | Use the method and system that the instant message of multiple client instance transmits | |
US20050021625A1 (en) | Communication apparatus | |
CN103796013A (en) | Method for photo compression in mobile terminal instant messaging | |
CN110933653A (en) | Message transmission method, device, terminal and storage medium | |
CN108696899B (en) | SIP message transmitting and receiving method and transmitting and receiving device | |
CN105099860A (en) | Method and system for performing real-time interaction in instant messaging and client | |
US20130016058A1 (en) | Electronic device, display method and computer-readable recording medium storing display program | |
EP2560343A1 (en) | Method, apparatus and system for displaying picture | |
JP5254576B2 (en) | Message reproducing method by mobile communication terminal and mobile communication terminal | |
CN104639501A (en) | Data stream transmission method, equipment and system | |
US20160100021A1 (en) | Information processing device, destination information updating method, and record medium | |
WO2014072739A1 (en) | Video distribution | |
WO2018010469A1 (en) | Data transmission method, device and storage medium | |
AU2019101539A4 (en) | Android-based image and text information feedback terminal system | |
CN112583822A (en) | Communication apparatus and communication method | |
CN110855553A (en) | Image transmission method and device based on XMPP (extensible Messaging and Presence protocol) | |
CN104283762A (en) | Method, system, client-side and server for transmitting instant messaging conversation content | |
KR100511298B1 (en) | Messaging service method of multi-media | |
CN113794622A (en) | Message processing method and device, electronic equipment and storage medium | |
KR100466830B1 (en) | Contents conversion method for terminal dependent messaging service on wireless internet | |
CN103634200B (en) | A kind of flash map sending system and flash map sending based on instant message | |
CN106878377A (en) | The safe supplying system and method for a kind of application message | |
CN114765603A (en) | Screen sharing method of mobile terminal, mobile terminal and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200228 |
|
RJ01 | Rejection of invention patent application after publication |