I have listed up images from a folder and trying to show the file size of an image on hover, but I seem that I get the same media id and therefore also the same size is shown. You can see an example here: http://fonnesberg.com/en/press/download/photos.aspx
you need to move your two variables size and sizeAndSuffix into your for-each loop that iteraties your images from. Currently, you're only getting the value once for the folder, which doesn't have this property.
Thanks for your answer. I had tried that before, but it didn't seem to make a difference.
As you can see on the image, I get the same id 1869 which is the id of my folder. I think it's because the mediaId is outside the loop, and it's just the id of the folder I picked.
So if I use ./umbracoBytes instead of $media/umbracoBytes I get the filesize of each image. Before I get 11 MB, so I think it only was the first image I get.
But I am not sure how to get the mediaId for each image?
I have changes the format of filesize to have to decimals:
File size of images with umbracoBytes
Hi..
I have listed up images from a folder and trying to show the file size of an image on hover, but I seem that I get the same media id and therefore also the same size is shown.
You can see an example here: http://fonnesberg.com/en/press/download/photos.aspx
Someone who can see what I am missing?
Bjarne
Hi Bjarne,
you need to move your two variables size and sizeAndSuffix into your for-each loop that iteraties your images from. Currently, you're only getting the value once for the folder, which doesn't have this property.
Cheers,
/Dirk
Hi Dirk
Thanks for your answer.
I had tried that before, but it didn't seem to make a difference.
As you can see on the image, I get the same id 1869 which is the id of my folder.
I think it's because the mediaId is outside the loop, and it's just the id of the folder I picked.
So if I use ./umbracoBytes instead of $media/umbracoBytes I get the filesize of each image. Before I get 11 MB, so I think it only was the first image I get.
But I am not sure how to get the mediaId for each image?
I have changes the format of filesize to have to decimals:
so the '#,###' to '#,###.##' ... do you know how to use comma instead?
Bjarne
Hmm... the images don't seem to be inserted correctly..
But you can see them when you enter our.umbraco.org in front of the url..
is working on a reply...