Page 1 of 2

Media upload

Posted: Thu Apr 22, 2010 4:02 am
by Dennis
Hi,

another question. I'm not very familiar with Flex. I've updated some screens with success, but more in depth changes I have more difficulty in.

I have a question about the media upload. Right now, when I add pictures through the admin site, in the database the path to the image is stored like /images/product/bla/blah
The actual files are stored in the image folder in the exploded admin module.

Thus, when I load up the demo webshopsite, it cannot find the images, cause it looks for /images in its own exploded folder path.
How can I fix this?

Re: Media upload

Posted: Sat Apr 24, 2010 4:44 am
by Dennis
anyone?

I'm very close to a release of my webshop with the help of this framework, but I cannot figure this one out, except for writing a whole new solution :(

Any help would be appreciated

Re: Media upload

Posted: Sun Apr 25, 2010 4:34 am
by Dennis
Okay, I made some progress by using context paths in Tomcat, but I need some information about how the actual file is stored in de admin application.

What I basically want to do is change the location of where the file is stored.
If I understand correctly in the MediaNewWindowViewHelper there is an upload method which is being called from the ShowFileUploadCommand.
Within this command, the path is given to where the file is stored.

However, when I change this value to whatever, it still stores the media file I upload in /broadleafadmin/images/ etc.
So the question is: where is determined where the app should store the files?

If someone can help me with this, I can fix the rest myself.
Thank you!

Re: Media upload

Posted: Mon Apr 26, 2010 8:06 am
by bradford.taylor
I just wanted to let you know that the post isn't being ignored. I'm going to look into it and try to get back to you shortly.

Re: Media upload

Posted: Mon Apr 26, 2010 8:36 am
by bradford.taylor
I wanted to confirm: you changed the line in ShowFileUploadCommand:

Code: Select all

MediaNewWindowViewHelper(ViewLocator.getInstance().getViewHelper("mediaNewWindowViewHelper")).uploadImage(ConfigModel.SERVER_IMAGES+"/category/"+category.id+"/",Media(sfue.viewData));


(or the equivalent product line) to go to a directory other than what is specified by ConfigModel.SERVER_IMAGES?

Re: Media upload

Posted: Mon Apr 26, 2010 2:27 pm
by Dennis
hi Bradford,
thnaks for replying.

Yes, what you say is correct. I change this line to whatever folder, but the files are still stored in the original folder : localhost:8080/broadleafadmin/images/ very strange :)

I did a mvn clean install, removed the exploded folder, removed the work folder in tomcat, to exclude caching issues, but it doesnt work.

Re: Media upload

Posted: Mon Apr 26, 2010 3:49 pm
by bradford.taylor
That should work. It is possible it's a caching issue with the modules. I've found that sometimes browsers use the cached version of a module instead of a new version available on the server.

One way to check this is to enter the module SWF URL in the browser to load the module directly. It will throw an error and show it if your using the Flash Debugger. After you load it then load the original URL. To be sure you can shift-reload after you have loaded the module URL. The module your working with here is Catalog so the URL will be http://{servername}:{port}/broadleafadmin/modules/catalog/CatalogModule.swf.

Would you mind trying that and letting me know the results?

Re: Media upload

Posted: Tue Apr 27, 2010 2:55 am
by Dennis
thanks for your reply.

I agree with you that it should be a caching issue, so I also tried to clear the cache from my browser. Maybe flash apps use a different kind of caching?
Anyway, I will try it. Also in another browser (IE), so caching cannot be the problem.

Re: Media upload

Posted: Tue Apr 27, 2010 8:46 am
by bradford.taylor
Working off trunk I just changed the SERVER_IMAGES constant in ConfigModel.as to nomoredir and used the BroadleafCommerceAdmin/build.xml file to compile-flex and launch-admin. I tested it with both a category and a product and the image was referenced from {server}/broadleafadmin/nomoredir/product/1/image.jpg.

Do you mind telling me what directory you are trying to change it to so I can test it?

Re: Media upload

Posted: Thu Apr 29, 2010 2:33 am
by Dennis
Hi Bradford,

thank you for your help on this issue. I got it to work now. I seemed to be indeed some kind of caching issue.
I did everything possible to clear the cache, but I guess I overlooked something.

Anyway, it works now, thank you very much!

One question (not related):

I made some changes / fixes throughout developing with the framework. What is the procedure to commit these? Do I email them to you for review, do I commit on a branch for a review, can't I commit at all until proven worthy :) How does it work on this project? I'd like to contribute my fixes...