I use Rich text Editor for uploading images & I create 1 data source for uploading image. When I upload image it is not shown (broken image logo), while I am not publish this image.
What is the problem?
The image is not shown because it cannot be severed for some reason. There could be any number of reasons for this. Here is how I would trouble shoot the issue:
upload an image via the RTE
Right click on the image, inspect element, look at the path to the image
it should say PROTOCOL://SERVER:PORT/static-assets/etc/etc/etc
If the URI doesn't start with static-assets then Crafter's download servlet cannot serve it. You need to fix the path in your datasource.
If the path does start with static-assets then check and see if the image is in your repository at that path specified. You probably won't find it there. If that's the case check your tomcat logs for an error. If the error doesn't help you, post it here and we will go from there.
Related
fellow developers.
Let's imagine the following scenario: A group of friends is playing Minecraft on a server. That server has a resource pack associated (file server.properties, field resource-pack). That resource pack is a ZIP file hosted by Dropbox, and the respective Dropbox share link is what goes on field resource-pack.
All good, for now. Resource pack loads flawlessly.
However, those friends need to update the resource pack with their custom textures every now and then. I'd like to automate that process in the best way possible. To provide a custom texture, one needs 2 files: a .png file and a .properties file. Those are fairly easy to make. Then, those files need to be put in the following directory (Dropbox):
/ResourcePack.zip/assets/minecraft/optifine/cit/
The problem here is that the Dropbox API can't upload to existing ZIP files, and the resource pack has to be a ZIP file, int order for Minecraft to recognize it. Also, I don't want to download the ZIP file, extract, put the files inside, compress and upload again, because it's quite a large file and that would take some time.
My Java application looks like this:
What the application does now, is accept dragged files and send them to the Dropbox path:
/ResourcePack/assets/minecraft/optifine/cit/
But not:
/ResourcePack.zip/assets/minecraft/optifine/cit/
I was told the Dropbox API can't handle uploads to ZIP files, and I also can't find anything on the documentation here.
Can anyone think of a solution, other than downloading the full resource pack, and uploading it back everytime someone wants to add custom textures?
Thank you.
EDIT:
So, as Adriaan suggested, I can simply use a direct link to the unzipped directory structure of the resource pack.
The problem is now another:
When a player joins the server, and downloads the resource pack for the first time ever, everything is fine. However, it gets cached in his local machine, in the following path:
/.minecraft/server-resource-packs/
So, when the resource pack is updated with new custom textures, minecraft will just load the cached resource pack and ignore any updates present in Dropbox. This results in the player not seeing the new custom textures.
I've learned about the resource-pack-sha1 field in server.properties. It looks just like what I need, but I can't quite understand how to use it.
Thanks in advance.
You can store the unzipped directory structure. DropBox allows downloading a directory as a zip file.
You can force dropbox to do a direct download by changing the dl=0 at the end of the URL to dl=1 see this help page
If the remark on the page you linked is still true "This is not yet used to verify the integrity of the resource pack, but improves the effectiveness and reliability of caching." then you could just enter a random new value into resource-pack-sha1 to trigger all clients to download the new pack.
If you need the actual digest then you could follow this mini tutorial
to generate an SHA1 for your server.properties:
visit this website: http://onlinemd5.com/
Upload your resourcepack
copy the SHA1 and paste it into your server.properties for the resource-pack-sha1 option
all done!
If you don't want to upload your resource pack to someone else's server you could download a tool to determine the digest locally.
Note: DropBox offers a content hash via their API, but it's not an SHA1 over the complete file. Rather they split the file in 4 MB blocks and determine the SHA256 for each, concatenate them and SHA256 the result again. If there's a way to change the hashing algorithm used by Minecraft this could be used.
EDIT: Is it an option to rename the resource pack directory on DropBox when you change its contents? This will circumvent the caching and hashing issue. Clients will just need to change the resource pack URL accordingly.
I want to upload the picture so that I can access it in my project, I have used the sendKeys("path of the picture") but by using it no action is performed,
please guide me, how to use the window pop up to upload the picture or give some idea, how can I upload the picture:
WebElement Account_logo = adriver.findElement(By.xpath("//*[#id='step1']/div[1]/div/div/div/form/div[12]/div[1]/div/div/span/div[2]/div[2]"));
Account_logo.click();
Account_logo.sendKeys("C:/Users/romit/Desktop/LOGO.jpg");
When setting the file path in your Java IDE, use the proper escape character for the back-slash.
Account_logo.sendKeys("C:\\Users\\romit\\Desktop\\LOGO.jpg");
Hope it helps !
If you want to upload a file, without having 'input' element, please refer SO Post
I have a non-scalable OpenShift app which uses the jbosseap cartridge and also has MySQL and PhpMyAdmin. I can upload and save image files to folders within the OPENSHIFT_DATA_DIR, e.g OPENSHIFT_DATA_DIR/appimages/uploaded.png but I have not been able to display the uploaded images with the HTML img tag.
There seem to be no way to get a correct path to images uploaded under OPENSHIFT_DATA_DIR. I ssh-ed into the server and found that OPENSHIFT_DATA_DIR, which evaluated to /app-root/data/ (actually /var/lib/openshift/5364c54ce0b8cd80180001f7/app-root/data/ ) was kinda outside the webroot of the app (where the ROOT.war was deployed to) which was /jbosseap/standalone/deployments/ROOT.war
So if the app runs from /jbosseap/standalone/deployments/ how can the app display images stored within OPENSHIFT_DATA_DIR which is /app-root/data/ since /app-root and /jbosseap are siblings of the same parent folder.
I just need to use HTML img tag to display an image uploaded and saved under OPENSHIFT_DATA_DIR e.g /appimages/uploaded.png since using src="/appimages/uploaded.png" for an img tag does not display the image.
One solution could be write a Servlet that would read image from $OPENSHIFT_DATA_DIR and write it to OutputStream. Your servlet would be mapped to /images/* and would serve all images. You can also refer to this question How to configure static resources in jBoss AS 7
I am unable to upload a product image in broadleaf commerce via the broadleaf admin site. When I try to upload image from a local file, I get the following error
HTTP ERROR 500
Problem accessing /admin/asset/uploadAsset. Reason:
File operation attempted on file that is not in provided work area. D:\DOCUME~1\Gutha\LOCALS~1\Temp\5e\a2\gal_w01.jpg. Work area = D:\DOCUME~1\Gutha\LOCALS~1\Temp\/5e/a2/
I tried creating that folder, and placing the image in that area, but it is of no use becaues each time a new folder is being shown here. Could any one tell me where should I place the images to be uploaded?
Thanks in advance.
Sounds like a bug. I've opened a ticket that you can track here ...
https://github.com/BroadleafCommerce/BroadleafCommerce/issues/773
If you can, let us know what version you are running into the issue in the above ticket.
FYI, I work for Broadleaf Commerce.
I'm trying to pull the path of a screen image I'm looking at on the android phone of the app im testing. The app shows various pictures. I want to pull the path of the picture to pull the picture name, but have no clue how to start. Any guidance?
edit:
I'm trying to find out if I could pull the path from the app code to see which image the user is viewing. for example. if im looking at an image, I want to know whats the path of the image (path should be coming from someone's harddrive)
there's not necessarily a path for an image. it's better to say the source of the image, be it a file, an HTTP stream, or otherwise. and unfortunately, that info is lost once it's set into an ImageView.
to set the image bits into an ImageView, you construct a Bitmap, usually using one of the decode*() methods in BitmapFactory. that is what determines the source of the image. in your unit test framework, you can get a handle to the ImageView by getting the Activity and calling findViewById(), but that's not going to help you.
there may be other places for you to hook into the code to determine that sources for the image data, but i can't say without knowing your application source code.
you could ask your developers to make the source available in the ImageView's tag (see setTag() / getTag()). that way you could pull it out in your unit tests. of course, you'll have to have an understanding with them as to what the source will be (a URL, a database URI, a file path, ?).