- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的 iOS 应用程序中,我需要用户能够发送带有 GIF 图像附件的电子邮件。我通过使用 MFMailComposeViewController 实现了这一点。如果 GIF 图像的文件大小很小,则一切正常。但是,如果图像尺寸较大,iOS 会要求缩小图像尺寸。如果用户同意缩小图像尺寸,GIF 动画就没有了。实际上,这与此处提出的问题相同:Preventing MFMailComposeViewController from scaling animated GIFs
我的理解是没有办法避免 iOS 要求减小尺寸。因此,我想的解决方案如下:我将在附加之前预压缩并生成一个文件大小减小的新 gif,以便它始终足够小。
所以我的问题是:是否有保证不会导致 iOS 要求减小图像大小的图像文件大小?例如,是否有类似“如果附加图像文件小于 X KB,邮件将永远不会要求减小图像大小”之类的内容,X 是什么?
最佳答案
我有一个阈值问题的答案和一个方法来缩小图像并可靠地避免 Apple 查询是否要缩小图像大小。
一些背景:
在我的应用程序中,我为用户提供了在发送电子邮件之前自动将他们的图像缩小到 1024x768 的选项,以避免 Apple 的“你想缩小你的图像吗?”查询。
很长一段时间,我认为这个除垢量就足够了。但是我发现,如果他们的图片有足够的细节,那么即使是 1024x768,它仍然可以触发 Apple 的查询。
所以,下面的代码是我如何处理这个问题的。请注意,如果 getMinImgSizFlag 为 TRUE,我已经在其他地方自动将图像缩小为 1024x768。
//...convert the UIImage into NSData, as the email controller requires, using
// a default JPG compression value of 90%.
float jpgCompression = 0.9f;
imageAsNSData = UIImageJPEGRepresentation( [self camImage], jpgCompression );
if ( [gDB getMinImgSizFlag] == TRUE )
{
//...if we are here, the user has opted to pre emptively scale their
// image down to 1024x768 to avoid Apple's 'scale the image down?'
// query.
//
// if so, then we will do a bit more testing because even with
// the image scaled down, if it has a lot of fine detail, it may
// still exceed a critical size threashold and trigger the query.
//
// it's been empirically determined that the critical size threashold
// falls between 391K and 394K bytes.
//
// if we determine that the compressed image, at the default JPG
// compression, is still larger than the critical size threashold,
// then we will begin looping and increasing the JPG compression
// until the image size drops below 380K.
//
// the aproximately 10K between our limit, 380K, and Apple's
// critical size threashold allows for the possibility that Apple
// may be including the contribution of the E-Mail's text size into
// its threashold calculations.
while ( [imageAsNSData length] > 380000 )
{
jpgCompression -= 0.05f;
imageAsNSData = UIImageJPEGRepresentation( [self camImage], jpgCompression );
}
}
就是这样。我已经测试了这段代码,它可靠地允许我避免 Apple 的你想在通过电子邮件发送查询之前缩小你的图像。
关于iOS:当附加大图像时,邮件何时要求通过缩放图像来减小邮件大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16702359/
我想在文本区域中向许多其他用户发送电子邮件。在名为内容的文本区域中,如果我键入星号包围的“用户”,我想让它们填写每个电子邮件的用户名(“@”之前的文本)。每封电子邮件中的每个用户名都会产生很多不同。然
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Problem when loading php file into variable (Load resu
我正在从数据库中提取信息,并尝试将其作为电子邮件发送。将从数据库中拉取多行数据。这就是我的代码的样子... 所有的信息邮件都很好。我的问题是,我想保留中断。例如,在标题之后,我想中断一下,然后开始备
当我使用我们使用 java 邮件的门户发送 TEXT 电子邮件时没有问题,但是,当我选择放置 HTML 内容并发送电子邮件时,会引发以下警报。花了几个小时搜索但没有有用的答案! 谁能帮忙 电子邮件主题
我有这个类,它处理 gmail 的登录。无论我输入什么电子邮件和密码,程序都会返回 session 。我不明白如何在返回 session 对象之前检查登录是否成功。 package mailActio
我设置的短信作为文本文件附在信中。我不明白为什么会这样。 replied letter example public void sendEmail(MimeMessage message, Strin
所以我正在制作一个网络系统,这个想法是当用户关闭浏览器时它会向我发送一封电子邮件。目前,用户正在使用 Javascript Ajax 来让 PHP 更新数据库的当前时间。当时间超过 5 分钟时,我希望
我想发送邮件,当产品从之前、日期和之后过期时,在 php 中,我在 php 中使用了 datediff mysql 函数,但如果产品过期日期类似于 31-1-2012 ,则不同值是不适合我的编码,请帮
我正在尝试设置一个邮件脚本,该脚本将首先从 mysql 运行一个简单的选择,并在消息中使用这些数组变量。然而,所有的变量并没有输出到消息体,只有一行变量。这是我的脚本: $sql1 = "SE
我最近一直在努力研究这个问题。是否有我可以使用并添加到其中的 android API?我想为电子邮件应用程序制作一个插件,但我不想制作整个电子邮件应用程序。 我非常想要一些已经可以处理发送和接收电子邮
嗨 我有一个 PHP 西类牙文网站。在此邮件正文中包含一个主题“Solicitud de cotización”,但该主题出现在热门邮箱中,如 Solicitud de cotización 。但它在
我想写一个脚本,使用 php 自动向我的客户发送电子邮件 我如何自动发送它,例如,如果他们输入他们的电子邮件。然后点击提交 我想自动发送这封邮件 其次,我的主机上是否需要 smtp 服务器?我可以在任
今天早上我已经解决了一个问题: Java Mail, sending multiple attachments not working 这次我遇到了一个稍微复杂一点的问题:我想将附件和图片结合起来。
下面是用于连接 IMAP 文件夹并对其执行操作的代码。所以我的问题是关于 javax.mail.Session 的,在这种情况下它会每秒重新创建一次(取决于 checkInbox() 的 hibern
我正尝试按照 http://www.tutorialspoint.com/java/java_sending_email.htm 上的指南发送电子邮件 Java 应用程序 当我尝试运行它时,从上面的链
我有一个包含 2 列 email 和 id 的表格。我需要找到密切相关的电子邮件。例如: john.smith12@example.com 和 john.smith12@some.subdomains
首先是一些信息: Debian 压缩 PHP 5.3.3 带有 mod_cgi 的 PHP 在这种情况下,我绝对必须使用 mail()。对于我所有的其他项目,我已经使用 SMTP 邮件。 我已将站点超
在对电子邮件主机的联系表单进行故障排除时,他们告诉我在 php 邮件功能的发件人地址中使用“-f”。 “-f”标志的作用是什么?为什么它可以解决允许发送电子邮件的问题?我阅读了一些文档,但不是很清楚。
一个简单的问题:群发邮件哪个性能好? mail() 函数或sendmail 流行的 PHP 列表管理器包使用哪个? 最佳答案 嗯,mail() 函数并不适合批量发送电子邮件,因为它会为您发送的每封
我正在制作一个 PHP 表单,允许用户上传附件并将其发送到我的电子邮件。我一直在寻找很长一段时间才能做到。最后,我找到了这个。 http://www.shotdev.com/php/php-mail/
我是一名优秀的程序员,十分优秀!