Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
sreedevi1984 #1
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: Problem in publishing photo (Vcard)
Publishing the fullname,nickname etc.., are working properly...But when I publish the photo with the same code, it doesn't work properly.. Can anybody please help me to solve this problem..

My code is as follows :

PublishVcard()
{
SetPicture(ofdBrowse.FileName);
vCard = new Vcard();
vCard.Fullname = "ABCDEF";
vCard.Photo = photo;
viq = new VcardIq(IqType.set,vCard);
viq.Vcard = vCard;
m_XmppCon.Send(viq);
}

The function SetPicture is as follows :

SetPicture()
{
// Getting Image from the fileName
myImage = Image.FromFile(filename);
// Getting the Image Format
string ext = Path.GetExtension(filename);
switch (ext.ToLower())
{
        case ".png":
        myImageFormat = ImageFormat.Png;
        break;
        case ".jpg":
        case ".jpeg":
        myImageFormat = ImageFormat.Jpeg;
        break;                      
        case ".gif":
        myImageFormat = ImageFormat.Gif;
        break;
 }
photo = new Photo(myImage,myImageFormat);
}



The Jabber string I got for the above is as follows

<iq type="set" id="aaf8a" >
<vCard xmlns="vcard-temp" prodid="-//HandGen//NONSGML vGen v1.0//EN" version="2.0" >
<FN>ABCDEF</FN>
<PHOTO>
<TYPE>image/jpeg</TYPE>
<BINVAL>
/9j/4AAQSkZJRgABAgEBLAEsAAD/7QlMUGhvdG9zaG9wIDMuMAA4QklNA+0KUmVzb2x1dGlvbgA
AAAAQASwAAAABAAEBLAAAAAEAAThCSU0EDRhGWCBHbG9iYWwgTGlnaHRpbmcgQW5nbGUAAAAABA
AAAHg4QklNBBkSRlggR2xvYmFsIEFsdGl0dWRlAAAAAAQAAAAeOEJJTQPzC1ByaW50IEZsYWdzA
AAACQAAAAAAAAAAAQA4QklNBAoOQ29weXJpZ2h0IEZsYWcAAAAAAQAAOEJJTScQFEphcGFuZXNl
IFByaW50IEZsYWdzAAAAAAoAAQAAAAAAAAACOEJJTQP1F0NvbG9yIEhhbGZ0b25lIFNldHRpbmd
</BINVAL>
</PHOTO>
</vCard>
</iq>

<iq type="result" id="aaf8a" />

Anything wrong in this..?

When some other views the above user's vcard, only fullname is displayed, the photo is null... The jabber string is as follows

<vCard xmlns="vcard-temp"><FN>ABCDEF</FN></vCard>

Please help me if u find it...

Thanks in advance...
Sreedevi
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

please take a look at this thread:
http://forum.ag-software.de/forum.php?req=thread&id=192

We published code fro updating  the vCard photo there.

Alex
Avatar
sreedevi1984 #3
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: publishing photo
I had written the code similar to the code in the following thread http://forum.ag-software.de/forum.php?req=thread&id=192 .. Even then it's not working properly..

Please help me to find out what' the problem...

Thank you very much...

Sreedevi
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post or attach more of your source code and please post a Debug XML log.
Without code and logs we are unable to find the problem.

The log you posted in your first posting contains a photo, but this log is not from agsXMPP. It looks like a PSI log to me.

Alex
Avatar
sreedevi1984 #5
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: debug xml log
Hai,

     This is the exact debug xml log when I set my vcard in Miniclient

 <iq xmlns="jabber:client" id="agsXMPP_5" type="set"><vCard xmlns="vcard-temp">
<FN>ABCDEF</FN>
<PHOTO>
<TYPE>image/jpeg</TYPE>
<BINVAL>
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAJYAyADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/
.......
......
</BINVAL></PHOTO></vCard></iq>
RECV: <iq xmlns="jabber:client" id="agsXMPP_5" type="result" />


and my code is

private void PublishVcard()
        {
            // Setting the Picture to Vcard
            SetPicture(ofdBrowse.FileName);
            vCard = new Vcard();
           
            vCard.Fullname = "ABCDEF";
            vCard.Photo = photo;
            viq = new VcardIq(IqType.set,vCard);
            viq.Vcard = vCard;
            m_XmppCon.Send(viq);
   
        }

        private void SetPicture(string filename)
        {
            try
            {
                // Getting Image from the fileName
                myImage = Image.FromFile(filename);
                // Getting the Image Format
                string ext = Path.GetExtension(filename);
                switch (ext.ToLower())
                {
                    case ".png":
                        myImageFormat = ImageFormat.Png;
                        break;
                    case ".jpg":
                    case ".jpeg":
                        myImageFormat = ImageFormat.Jpeg;
                        break;                      
                    case ".gif":
                        myImageFormat = ImageFormat.Gif;
                        break;
 
                }
                photo = new Photo(myImage,myImageFormat);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to load photo");
                Console.WriteLine(ex.Message);
            }
        }

Thanks...
Sreedevi
Avatar
Alex #6
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this looks ok and the server accepted your vCard.
So i see no problem here.

Alex
Avatar
sreedevi1984 #7
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: thank u
Thank you very much for your support..

Sreedevi
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS