Fórum

Image User

luca rocco, modificado 8 Anos atrás.

Image User

New Member Postagens: 11 Data de Entrada: 02/02/15 Postagens Recentes
Hi,
I must draw the user's picture. I use:

LRPortraitUtil *service=[[LRPortraitUtil alloc] init];
    NSLog(@"service %@",service);


After, I should use:

+ (NSString *) getPortraitURL: (LRSession *) session evil: (BOOL) male
portraitId: (long long) portraitId uuid: (NSString *) uuid;


But, as I have to write(for NSString)? For NSDictionary, I use(example):

NSDictionary *Contact =[serviceContact getContactWithContactId:contactid error:&error];
        NSLog(@"Contact %@",Contact);


For NSString?


Thanks emoticon
thumbnail
Andew Jardine, modificado 8 Anos atrás.

RE: Image User

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi luca,

I don't think I have the answer to your question but I have to ask -- what is that code you shared?
thumbnail
David H Nebinger, modificado 8 Anos atrás.

RE: Image User

Liferay Legend Postagens: 14916 Data de Entrada: 02/09/06 Postagens Recentes
Andew Jardine:
I don't think I have the answer to your question but I have to ask -- what is that code you shared?


Dude, that's native mobile code leveraging the Liferay mobile SDK... emoticon
thumbnail
Andew Jardine, modificado 8 Anos atrás.

RE: Image User

Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hahaha -- I figured that as soon as I asaw the next response referencing a "screenlet". I've never done anything with the mobile SDK. Forgive my ignorance emoticon
Giacomo Boemio, modificado 8 Anos atrás.

RE: Image User

New Member Postagens: 5 Data de Entrada: 19/01/15 Postagens Recentes
You use:

#import "LRDLFileEntryService_v62.h"
luca rocco, modificado 8 Anos atrás.

RE: Image User

New Member Postagens: 11 Data de Entrada: 02/02/15 Postagens Recentes
I solved it this way:


LRDLFileEntryService_v62 *fileentry =[[LRDLFileEntryService_v62 alloc] initWithSession:session];
        NSLog(@"fileentry %@", fileentry);

NSDictionary *logo=[fileentry getFileEntryWithGroupId:group folderId:0 title:@"logo" error:&error];
        NSLog(@"logo %@", logo);


But, now...I have to add the image in that folder. First, I delete the image and then add. Right?

To add, I use:

- (NSDictionary *)addFileEntryWithRepositoryId:(long long)repositoryId folderId:(long long)folderId sourceFileName:(NSString *)sourceFileName mimeType:(NSString *)mimeType title:(NSString *)title description:(NSString *)description changeLog:(NSString *)changeLog bytes:(NSData *)bytes serviceContext:(LRJSONObjectWrapper *)serviceContext error:(NSError **)error;


The image is loaded (I read the json of response), but I visualize(on portal) a document file, not image. Why? It seems not to see the extent of my image. Where I am wrong? I pass NSData of bytes, in this mode:

UIImage *ImageUSER=[UIImage imageNamed:@"img.png"];

    NSData *imageData = UIImagePNGRepresentation(ImageUSER);


How should I do?
luca rocco, modificado 8 Anos atrás.

RE: Image User

New Member Postagens: 11 Data de Entrada: 02/02/15 Postagens Recentes
It can be a problem ServiceContext?

I use:

NSDictionary *jsonObject = @{
                                 @"addGroupPermissions": @(YES),
                                 @"addGuestPermissions": @(YES)
                                 };
    
    LRJSONObjectWrapper *serviceContext = [[LRJSONObjectWrapper alloc] initWithJSONObject:jsonObject];
thumbnail
Jose M. Navarro, modificado 8 Anos atrás.

RE: Image User

Regular Member Postagens: 138 Data de Entrada: 24/01/14 Postagens Recentes
Make sure the mime type parameter in the addFile call is right (image/jpeg)
thumbnail
Jose M. Navarro, modificado 8 Anos atrás.

RE: Image User

Regular Member Postagens: 138 Data de Entrada: 24/01/14 Postagens Recentes
Luca, when you have your NSString filled with the result of getPortraitURL method, you have to make a new request to get that image data. When the request is completed, use a UIImageView to show it in your view controller.

Maybe it's easier if you use UserPortraitScreenlet in your project. It's a way to show a user image with less code. Check the product page for more details and ask any question in Liferay Screens forum.

Regards

JM