-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG:Android使用loadFromFile()无法加载图片 #4
Comments
不是Bug,ViewHelper有相应的设置图像路径的函数setImagePath。 |
知道了,但是setImagePath貌似只能设置一个路径,如果我要自动加载的图片在不同的目录应该怎么解决呢? |
可以先放在一个目录再插入图片。
|
好吧,这样倒是可以。如果在insertImageFromFile中传入图片的全路径,貌似路径+名称超过63个字符就加载不出来了,这是为什么呢? |
无路径的内部名称不超过63的 谢谢
|
这个可以修改吗? |
文件mgimagesp.cpp中:
bool MgImageShape::_save(MgStorage* s) const
{
s->writeString("name", _name);
s->writeFloat("imageWidth", _size.x);
s->writeFloat("imageHeight", _size.y);
LOGE("save() ----------> name = %s", _name); //打印结果:*.jpg
LOGE("save() ----------> _size.x = %f", _size.x); //打印结果:0.000000
LOGE("save() ----------> _size.y = %f", _size.y); //打印结果:0.000000
return __super::_save(s);
}
其中_name只包含图片的名称,不包含其路径,所以导致图片加载不出来
我把代码改为:
s->writeString("name", "/sdcard/image/img01.jpg");
s->writeFloat("imageWidth", 400);
s->writeFloat("imageHeight", 300);
之后就可以加载图片了,但是加载出来的都是图片/sdcard/image/img01.jpg,请问这里应该怎么修改啊?
我不知道这里的_name,和_size.x,_size.y是从哪里传进来的?还望指教一下,不胜感激!
The text was updated successfully, but these errors were encountered: