You can't detect if a resource is available in a formula field. You would necessarily need client-side detection (Visualforce). You can embed Visualforce pages inside a page layout, so this wouldn't necessarily be very complex:
<apex:page standardController="Product2">
<script>
(function(document, window, undefined) {
function showError(event) {
var target = event.target || event.srcElement, error = document.createTextNode("Image not found");
target.parentNode.appendChild(error);
target.parentNode.remove(target);
}
function onload() {
var image = document.createElement("img");
img.addEventListener("error", showError, true);
img.src = "/resource/ProductImages/{!Product2.ProductCode}.jpg";
document.body.appendChild(img);
}
window.addEventListener("load", onload, true);
})(document, window);
</script>
</apex:page>
Here, we try to load the image, and on failure, we show an error in its place. Note this code does depend on addEventListener, which is supported by every browser supported by their appropriate vendors (e.g. not IE8). If you care for IE8 support, add code to detect window.attachEvent
and modify appropriately.
Try something like this:
IMAGE(CASE( Status__c ,
'Open', '/resource/status/green.png',
'Closed', '/resource/status/red.png',
'Planning', '/resource/status/yellow.png',
''), "rating")
http://luckytechshare.blogspot.in/2015/02/display-images-in-salesforce-reocrd.html
If it still does not work for you then check the path in zip file. Use View source and copy paste the SRC of image tag in the new tab and experiment with it.
Many times there is issue with path that is gendered.
Best Answer
This example displays the image regardless of the value in any field.
This example displays an image of a green square if the amount of an opportunity is greater than 100, a yellow square if it's under 51 and 99, and a red square if it's less or equal to 50. (You have to upload three images for this example)