Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 1    Views: 66

AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
03/16/16 09:52 AM (8 years ago)

Email Image plugin - email landscape oddity - fixed

I'm building an app with this nice plugin as one of the features. All good on an iPhone, but on an iPad (I don't currently have one), I am being told pictures taken when the device is on its side, arrive distorted. It looks as if the image is being modified / compressed when emailed. I've tried locking rotation in the app but it doesn't stop the user holding the iPad sideways on and taking a picture. Any suggestions please?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
03/22/16 06:13 AM (8 years ago)
I found out what was going wrong and it applied to both iPhone and iPad. In xcode, navigate to folder BT_Plugins, then folder email_image and edit file Emal_image.m around line 406, find a ‘method called -(void)setImage:(UIImage *)selectedImage Basically, this method has some logic in it that tries to compress the image by adjusting the width and height before emailing it. Problem is it doesn't seem to cater for landscape. I simply removed that logic and now the emailed image is fine. A bit big maybe, but fine. So my fix, which isn't the most elegant as I have commented out redundant code rather than deleting it, was to replace the existing setImage method with the one below i.e cut from line 406 to 435 and paste the replacement which is below: //setImage -(void)setImage:(UIImage *)selectedImage{ [BT_debugger showIt:self theMessage:@"submitImage"]; //scale image to size of screen- ajm do we need to check orientatio maybe ? if(selectedImage){ NSLog(@"* * setImg Selected Image"); //delegate bbox_appDelegate *appDelegate = (bbox_appDelegate *)[[UIApplication sharedApplication] delegate]; //int newWidth = 320; //int newHeight = 480; //if([appDelegate.rootDevice isIPad]){ // newWidth = 768; // newHeight = 1024; //} UIImage *scaledImage = selectedImage; // UIImage *scaledImage = [self imageWithImage:selectedImage scaledToSize:CGSizeMake(newWidth, newHeight)]; // UIImage *scaledImage = [BT_imageTools scaleProportionalToSize:selectedImage size:CGSizeMake(newWidth, newHeight)]; //set image [self setImageToEmail:scaledImage]; [self.imageToEmailView setImage:scaledImage]; //hide underlying graphics [self.bgImage setHidden:TRUE]; } }
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.