Don’t worry. I won’t forget about you guys! [import]uid: 32256 topic_id: 12957 reply_id: 53001[/import]
I’ve. Seen other apps start the local Facebook app and allow you to upload images. Can you guys look. Into that for ( wish list item) either way uploading to Facebook would be nice. [import]uid: 11860 topic_id: 12957 reply_id: 53030[/import]
Sorry for the delayed response but I’ve been trying to sort out all the possible display.save and display.capture issues.
I confirmed the “black line” problem you are seeing with display.save. I’m seeing a one pixel black line on the left side in landscape mode and on the top in portrait mode. This only occurs when you have dynamic scaling enabled (setting the width and height in config.lua) and running on a device that has an odd scaling factor (e.g., iPad). We haven’t confirmed it but it looks like a math rounding error because the scaling factor is 2.3333… and the code is saving the image offset by one pixel (hence the black line).
The size different you are seeing is because of the image is saved in higher resolution on the iPad. If you ran it on an iPhone, you would see an image twice the size of what you saved. The size different on the iPad depends on the scaling mode (letterbox, zoomEven, etc.).
Other than the problem above, my test shows that saving an image with display.capture or display.save works on all devices in both portrait and landscape mode in both native and dynamic scaling (testing on build 605).
I did find a problem with display.capture in Landscape mode that causes the image that is displayed on the screen after the capture to be offset and/or cutoff. The saved image in the Photo Gallery is correct. This would cause a problem if you tried to use display.save to save the image to a local file. This is on our list of problems to fix.
I’m also looking into issues with groups not scaling correctly. This may be part of the issue you were seeing in your original code.
-Tom [import]uid: 7559 topic_id: 12957 reply_id: 53080[/import]
@Tom, indeed, I think the black line problem IS really my only “real” problem. I’ve been trying a ton of things to work around that problem so probably anything else I’ve been having issues with result from the mess my attempted work arounds have made.
I’d note it could be anything with some sort of rounding and not just iPad … I know I’ve seen them on the iPhone 3Gs and 4 with “odd sized” images that I’ve emailed to myself to use in the program. (Remember you can email an image, save to roll, and then use it in an app… so not all images are screen size … I know, I’m getting picky.
… Got ya on the size thing … that explains a few things and is another really good reason I need the “display.save” of an image to just copy an image.
–> We’re allowing people to export their inspiration boards – we upload the pieces, images, data, to the server… and then people can import them into their device.
So this scaling thing being the case, there is no way for me to natively save a 120x240 image on the iPad and send that to an iPhone, I’m poop-out-of-luck. Or I’ve got to know that the image had been up-sized, then re-downsize it or something. Starts to make for messy images. Hopefully that’s not a complicated addition to the Corona code.
Either way, once the fix is in for this black line issue and I see the black lines go, I will scrap this section of code and write it again how I’d like it written with the knowledge there won’t be black lines.
Thanks!
~~Kenn [import]uid: 13859 topic_id: 12957 reply_id: 53145[/import]
Hey Kenn…I’m sure this is dramatically over-simplifying your problem, but if you know for certain:
a) under what conditions the black edges occur
b) how wide (pixels) the black lines are
c) that Corona will crop any off-screen portions at time of save
could you just position the image partially offscreen, before you save it to clean it up yourself?? [import]uid: 6175 topic_id: 12957 reply_id: 53154[/import]
Well, I’m not entirely sure i always know, I’ve seen it on top and side with different image sizes. I suppose I could likely just play it safe and always just take 1 pixel off all the sides … possibly 2 – cause i do think the rounding error occasionally creates 2 pixels… (but that could totally be my imagination and the way it looks on the screen.)
… but that’s really interesting … and you likely just sorta answered the “corona can’t crop” issue… given that you could really fully rotate an image to crop it exactly as needed… people would likely enjoy a community code function that does that. *poke poke*
… though i think I might just wait for tom to hopefully tackle this little rounding error thing, assuming it’s not a long long wait from this point where he’s tacked down where it is. [import]uid: 13859 topic_id: 12957 reply_id: 53157[/import]
double post. eek. [import]uid: 13859 topic_id: 12957 reply_id: 53158[/import]
Is attachment to e-mails still on the wish list?
Just following up on this.
Thanks! [import]uid: 66859 topic_id: 12957 reply_id: 58002[/import]
MeApps,
The e-mail attachments feature is still on our wish-list, but not schedule just yet. We do know that it is a highly desired feature… and we may need to add it for another *secret* feature idea that we’re playing around with. [import]uid: 32256 topic_id: 12957 reply_id: 58071[/import]
Joshua:
D’accord! Hopefully we don’t have to wait too long My App is pretty much die without this feature. (5 one start ratings because they can’t share plays)…
Thanks for the follow-up!
Willy J.
[import]uid: 66859 topic_id: 12957 reply_id: 58073[/import]
I can think of one quick way to implement e-mail attachments. Currently, you can display the device’s default mail client window by calling Corona’s system.openURL() with a “mailto” scheme. So how about we create a custom “attachment” tag in the mailto URL scheme as follows?
local url =
'mailto:someone@somewhere.com?' ..
'subject="Hello"&' ..
'body="This is a test"&' ..
'attachment="' .. system.pathForFile("MyFile.txt", system.DocumentsDirectory) .. '"'
system.openURL(url)
The limitation are:
- Will display a mail window. Cannot e-mail in the background.
- The app will be suspended while the mail client is displayed.
- Android only supports 1 file attachment.
Will this work for you? [import]uid: 32256 topic_id: 12957 reply_id: 58083[/import]
Actually, scrap my mailto idea for sending attachments. We can make it work on Android but NOT iOS. That means our only option is to set up an in-app mail client, which will not be a quick thing to do. [import]uid: 32256 topic_id: 12957 reply_id: 58121[/import]
@Joshua … I’d note to all the folks that we do actually have all the pieces we need to create our own mail system now that you’ve added editable, multi-line text boxes!
If one uses the code exchange’d piece that I put up with uploading files, the new editable textbox, you can easily generate a mail form and upload one or more files to attach and send out from a server. It’s a pretty easy client / server system for sending attachments…
One last piece that you could hopefully more easily give us that would bring this all together would be access to the Contacts on a device. I’m pretty sure we don’t have that and it would seem that should be a pretty “native” function to add. Maybe.
Best,
~~Kenn [import]uid: 13859 topic_id: 12957 reply_id: 58123[/import]
I’ve been wanting to attach pictures to emails for quite some time now… so after reading the last few posts and your upload code ken i thought id give it a go…
BUT ive hit a snag… Heres the code i use for sending the email.
local function emailInvoice()
local function upload( event )
--Normal Email set up
local i = event.index
local subName = "testPictureEmail"
local invoiceString = "Testing sending a picture in a mail...\nThis probably wont work at all..\n\n"
invoiceString = string.gsub( invoiceString, " ", "%%20")
invoiceString = string.gsub( invoiceString, "\n", "%%0A")
--Picture set up
local mime = require "mime"
local picPath = system.pathForFile( "testsend.jpg", system.DocumentsDirectory )
local picHandle = io.open( picPath, "rb" )
local picBody = mime.b64( picHandle:read( "\*a" ) )
if 2 == i then
--Close alert box
elseif 1 == i then
--Send Mail
system.openURL( "mailto:tech@tandgapps.co.uk?subject="..subName.."%20&body="..invoiceString..picBody )
end
end
local alert = native.showAlert("ALERT","You need an internet connection to send an invoice...", {"OK","Cancel"}, upload)
end
It opens the email just fine, with a subject field, and the text i entered in the body. But the image is just a long string.
My experience with base 64 is very limited, but i presume this is happenening because im not decoding the image so its no longer that long string?
Any thoughts on how i can get around that?
Thanks. [import]uid: 69826 topic_id: 12957 reply_id: 58141[/import]
Ah… Well no…
I was referring to actually writing a custom mail “server” — AKA a PHP script sitting on a hosted server somewhere that your app would connect to and send the attachment/ email to using the basic Corona Upload / PHP receiver system from the code exchange. From there, your PHP script on the server would fashion the correct email setup to send out an attachment. The users also wouldn’t leave the app to go to the iPhone / Android mail system.
There’s two general down falls to the system … the first being the lack of Contacts.
… The second being figuring out how to secure the email server well enough that bad people weren’t figuring out how to send their email through it. One way around that might be host the content on the server and email out an HTML email with an Iframe or dynamically loaded content.
Maybe it’s not that easy. I was just saying it IS possible. *grin* [import]uid: 13859 topic_id: 12957 reply_id: 58142[/import]
… Well, another downfall is that the user actually has to enter a “from” address because you won’t know what their from address is set as in the phone. So they’d have to type it in which leaves yet more room for bad people and hooligans.
…So, um, yeah. I suppose this is highly dependent on your purpose and desperation. lol. [import]uid: 13859 topic_id: 12957 reply_id: 58143[/import]
Ah ok then, so basically trying to get that encoding/decoding images into emails (without using a server/php script like you did) isnt possible right now then?
I know you can do something like that using SMTP but i dont want to use that really…
Thanks for the reply ken, i appreciate it. I dont think i can go with the hosted server method though unfortunetly, mainly due to the fact that i dont have the knowledge to set it up so that it cant be abused by other people lol. [import]uid: 69826 topic_id: 12957 reply_id: 58146[/import]
The iOS developer here told me that Apple frowns upon sending e-mail in the background. They prefer that end-users opt into sending e-mail and should use iOS’ built in mail client. If that’s true, then we don’t want to risk people’s apps from being unapproved due to this.
I’m thinking we’ll have to do this the “right” way and display the platform’s built-in mail client. We’ll need to create a new Corona function like this…
-- Show an empty mail window.
native.showSendMail()
-- Show a mail window initialized with the following settings.
local options =
{
to = {"bob@somewhere.com"},
cc = {"john.doe@somewhere.com", "jane.doe@somewhere.com"},
bcc = {"smith@somewhere.com"},
subject = "My E-Mail Title",
body = "Hello World!",
attachment = system.pathForFile("MyFile.txt", system.DocumentsDirectory)
}
native.showSendMail(options)
I foresee one problem with the above. The native mail window on Android is blocking and will suspend Corona, but the iOS native mail window will not and works more like a popup. Oh the joys of cross-platform development.
I’d like to avoid us setting up our own SMTP client because then the user would have to provide their mail client settings into the app… which is wasteful considering it is already set up on their mobile devices default mail client.
Anyways, there’s my 2 cents. Your thoughts? [import]uid: 32256 topic_id: 12957 reply_id: 58229[/import]
I think doing it the “right” for iOS now is a good starting point. If Corona has it’s own SMTP client will the user have to provide their mail client settings into the app every time the app is launched?
[import]uid: 66859 topic_id: 12957 reply_id: 58235[/import]
>> If Corona has it’s own SMTP client will the user have to provide their mail client settings into the app every time the app is launched?
Ideally, Corona would store the settings for you so that they are remembered the next time the app is launched. What I don’t like about this is that the mobile device’s mail settings will likely already be set up in the default mail client, so it is inconvenient for the user to enter these setting into the app again. Especially since most end-users will not be tech savvy enough to know how to set up an SMTP client. Ideally, Corona would fetch the main SMTP settings from the OS, but I suspect these settings are not made available. I’ve notice that the popular K9 mail client on Android forces you to input your own SMTP settings, suggesting that the default mail client’s settings are not available on the OS. [import]uid: 32256 topic_id: 12957 reply_id: 58236[/import]