小编Ben*_*Ben的帖子

UPLOAD_ERR_PARTIAL 带有来自特定浏览器/操作系统的特定图像

我在 PHP 中遇到文件上传问题。我正在使用调用 PHP 脚本的 Dropzone.js。

PHP环境运行在Docker上,PHP版本为:7.2.28

当我在 Mac OSX 上使用 Firefox 72 上传图像时,我在 $_FILES 中得到了这个:

Array\n(\n [file] => Array\n (\n [name] => image.png\n [type] => \n [tmp_name] => \n [error] => 3\n [size] => 0\n )\n\n)\n,
Run Code Online (Sandbox Code Playgroud)

根据文档:错误 3 表示 UPLOAD_ERR_PARTIAL。

该问题仅在 Mac OSX 上的 Firefox 中发生,具有此特定大小 (158ko) 的 PNG 图像。

其他文件大小(甚至很小或很大的文件)、其他浏览器、其他文件类型或其他操作系统都可以正常工作。

docker 镜像在 3 个不同的服务器上运行,每次安装都会出现问题。

我尝试了一些我在互联网上阅读的解决方案,但都没有奏效:

  • php_sapi_name() 返回 apache2handler
  • 我试图将“接受范围:无”添加到我的 php 文件中。

你有什么可能发生的线索吗?

提前致谢,

php macos upload

7
推荐指数
0
解决办法
86
查看次数

内存使用量随着CTFontCreateWithName和CTFramesetterRef的增加而增加

我正在编写一个使用自定义字体(CTFontManagerRegisterFontsForURL)的IOS程序。我加载字体,将其添加为字符串属性,创建框架设定器,然后创建框架,并将其绘制到上下文中。我释放我使用的所有东西。仪器没有发现泄漏,但:

使用此功能时,应用程序使用的内存会增加而不会减少。离开功能时,字体的保留计数为2。

这是代码:

CFMutableAttributedStringRef attributedStringRef = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
CFAttributedStringBeginEditing(attributedStringRef);
CFAttributedStringReplaceString(attributedStringRef, CFRangeMake(0, 0), (CFStringRef)label.text);

font = CTFontCreateWithName((CFStringRef)label.fontName, label.fontHeight, NULL);
Run Code Online (Sandbox Code Playgroud)

保留字体数:1

CFAttributedStringSetAttribute(attributedStringRef, CFRangeMake(0, label.text.length), kCTFontAttributeName, font);
CFAttributedStringEndEditing(attributedStringRef);
Run Code Online (Sandbox Code Playgroud)

保留字体数:2

CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, rect);

CFRelease(font);
Run Code Online (Sandbox Code Playgroud)

保留字体数:1

CTFramesetterRef frameSetter = CTFramesetterCreateWithAttributedString(attributedStringRef); 
Run Code Online (Sandbox Code Playgroud)

保留字体数:3

CFRelease(attributedStringRef);
CTFrameRef frame = CTFramesetterCreateFrame(frameSetter,
                                            CFRangeMake(0, 0),
                                            path, NULL);
Run Code Online (Sandbox Code Playgroud)

保留字体数:5

CFRelease(frameSetter);
Run Code Online (Sandbox Code Playgroud)

保留字体数:4

CTFrameDraw(frame, ctx);
CFRelease(frame);
Run Code Online (Sandbox Code Playgroud)

保留字体数:2

CGPathRelease(path);
Run Code Online (Sandbox Code Playgroud)

是否有某种缓存?我真的需要立即清除此字体使用的内存。

PS:我使用CFGetRetainCount来获取字体的保留计数。

谢谢 !

iphone fonts objective-c core-text ios

5
推荐指数
1
解决办法
3751
查看次数

标签 统计

core-text ×1

fonts ×1

ios ×1

iphone ×1

macos ×1

objective-c ×1

php ×1

upload ×1