You need to sign in to do that
Don't have an account?
GlobalExpeditions.ax998
Problems with displaying static resource .zip images in my VF page
So this is a bit strange....
I have a VF page written that creates badges(labels) for contacts with their name and picture.
The way we are gettin multiple pictures is by refrerencing a .zip file as a static resource.
The funny thing about this is that when I try to upload the zip file to the static resource it does not work (the pictures come up broken) but.... when my collegue uploads it the exact same way, the files work great.
We are both using Mac osx. My operating system is 10.6.7 and his is a bit newer.
Any ideas about this one???
With the same zip file? Or did you each produce your own zip file and upload it? I know some mac users have had trouble with zip files not having the directory structure they expected...
All Answers
With the same zip file? Or did you each produce your own zip file and upload it? I know some mac users have had trouble with zip files not having the directory structure they expected...
No we are both compressing the files individually. I haven't been able to isolate where the problem is occurring, but I have to think its either when I'm zipping the file, or when I am saving the photo's as .jpg's in preview.
I will say that when I am compressing the file, all I'm doing is right clicking the folder and selecting "compress file". Should I try to compress using a third party program?
Do you know of any way to fix this?
Don't know much about creating archives on a mac. But the issue I've seen is that when compressing a folder foo, some people seem to get a foo.zip that contains a folder foo containing their files, and some people seem to get a zip containing just the files. I think the difference is whether you select the folder and select create archive, or open the folder and select all the files and select create archive containing n files.
If this is the issue, either form will work, but you have to reference them differently in your page.
Hmm, well I just downloaded the free trial of Winzip for mac, and sure enough it sloved the problem.
Don't know what it is with the mac osx built in compressor but that did the trick.
Thanks so much for the feedback.
Cheers
I had the same problem. Reading this thread gave me an idea since Winzip appeared to solve the issue.
If I put all the files in a folder and archived the folder to a .zip, Salesforce displays a blank document for the .css (or any other) file when navigating to the .css file using view frame source in Chrome. Example SF url: https://c.na1.visual.force.com/resource/<orgnumber>/zip/mycssfile.css <-- nothing displays
However, If I open the folder, select all the items in the folder, right click, and select Compress <number of items> Items to create the zip, Salesforce works as it should. Using the same navigation from above, I can see the contents of the css file.
I tried playing with the file archive settings as described in the Macworld article listed below but couldn't come up with a good native solution.
http://www.macworld.com/article/60973/2007/11/prefarchives.html
It looks like Winzip for Mac or the solution listed above are at least viable workarounds.
Upon further review
... /resource/<orgnumber>/zip/folder/mycssfile.css works just as well. In Apex:
<apex:stylesheet value="{!URLFOR($Resource.zip, 'folder/mycssfile.css')}"/> instead of
<apex:stylesheet value="{!URLFOR($Resource.zip, 'mycssfile.css')}"/>
I am using OSX 10.7 Lion with the default archive settings.
http://boards.developerforce.com/t5/Visualforce-Development/Can-t-access-files-in-a-zipped-static-resource/td-p/164280/page/2
For me it was the way the zip files were getting generated. My code was pointing to fileName.zip/css/style.css. However when we did a zip, the actual contents were more like fileName.zip/fileName/css/style.css. Once I got that figured, it was smoot sailing.
In my case, on my desktop I have a folder called "Resources" with a "js" and "css" subfolder. If I right-click on the "Resources" folder and add to zip, it creates a zipfile with Resources\js and Resources\css inside. My code references \js and \css, without the parent "Resources" folder. This causes the VF page to not find the resources.
In Windows, using WinZip, I create an empty zip file and drop the folders into it manually, which eliminates that root folder.