Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am using v2.5.7
I have created my virtual directory and I have followed the instructions to put the <ImageBaseDir> into the imagegen config file. However I keep getting the File not found error when I copy the image url into my url bar.
I can hit the image if I go via localhost/media/someimage.jpg but when I go through the ashx I just get the file not found error.
Am I missing some setting or something here?
My imagegen config imagebasedir section is like so
Im not missing the ashx file.
I have set it up in web.config.
Thanks a lot.
Let's start with the easy stuff and work up from there...
Temporarily remove the <ImageBaseDir> from the imagegen.config file for the class="default" entry. Once done you should be able to see your image at both:
http://localhost/media/someimage.jpg and http://localhost/imagegen.asxh?image=/media/someimage.jpg&width=100
Once that works you can reinstate the <ImageBaseDir> in the class="default" entry of imagegen.config and this should now work:
http://localhost/media/someimage.jpg and http://localhost/imagegen.ashx?image=someimage.jpg&width=100
If you'd rather not use the same ImageBaseDir for every request to imagegen you can create unique classes in the imagegen.config with unique (or no) <ImageBaseDir> settings. Each class will get its own name and you'd include that on the url. If you made an entry with class="phil" and <ImageBaseDir>/media</ImageBaseDir> your request would be:
Thank you for the fast reply.
When I remove the <ImageBaseDir> from my class="default" and then go in with http://localhost/imagegen.ashx?image=/media/someimage.jpg&width=107&height=91 I get this error.
Requested image path is not allowed. (/media/someimage.jpg)
Which I presume would be correct as I am trying to access the file in my media virtual directory.
Ah, yes, that's correct. For security reasons (so people can't attempt to troll your drives and shares) images must actually reside within the site's folder structure. Silly me for not thinking before typing.
If you want to get outside the site's folder structure you must use the <ImageBaseDir> either in the default class (for every request) or in individual classes (for specific requests that include the &class= parameter on the querystring). For now, let's just use the default class.
I'm not satisfied with how the code in 2.5.7 works and I think there are some scenarios where it just won't work properly. It's being heavily reworked for the next release. So it's possible we may stumble on a bug as we work on a solution.
You can set specific drive paths in such as <ImageBaseDir>z:\media</ImageBaseDir> and that should work. But obviously you need to map the drive on the server. You can try a UNC path but I'm not sure if that will work properly currently, such as <ImageBaseDir>\\hercules\media</ImageBaseDir>. The key is to point to the same place your virtual directory ultimately resides. Virtual paths at the webserver level is not enough for ImageBaseDir, as you've seen, but one of these other options should be just fine.
I have been experimenting with different paths in the <ImageBaseDir> today and not found one that works yet. This is why I thought there could be something I have missed.
I tried changing the path to <ImageBaseDir>c:\testing\media</ImageBaseDir> where I still get the File Not Found error.
File not found: /media/someimage.jpg. Double-check the ImageBaseDir setting in the ImageGen.config file.
I have also tried <ImageBaseDir>http://localhost/media</ImageBaseDir>; where I get the following
The remote server returned an error: (404) Not Found.
You might have been on the right track with some of them but remember that whatever you include in the ImageBaseDir you don't include in the ?image= querystring.
In other words... if you have an image at /media/someimage.jpg and you put the /media part in the ImageBaseDir then your request would only be for someimage.jpg because ImageBaseDir will be pre-pended to the request and add the /media part back in.
Hope that makes sense.
Brilliant thats where I was going wrong.
Thank you Doug Great help!
i know this is an old thread, but i have the same problem....
using: ImageGen Professional version 220.127.116.11945
I'm working on a local dev environment. And we have our media folder on another server which can be accessed directly thru a UNC path //<server name>/<app>/media
So i made a virtual directory in IIS and pointed to the media folder on the server.. Accessing media files normally through the site http://site.local/media/someimage.jpg is working fine.
I have configured the imagegen.config file as follow. The default class is empty and i have a Media class, which we add on all the images. I've added the ImageBaseDir to it to the UNC path of the server.
You would think this is correct.. But when i try to request an image:
i get the following: File not found: /media/69107/rdm.jpg. Double-check the ImageBaseDir setting in the ImageGen.config file.
<Class Name="default" OverridesQueryString="true">
<Class Name="media" OverridesQueryString="true">
What am i doing wrong??
thanks in advance... is UNC paths allowed in this version?
ImageGen 2.5.7 has a bug that breaks support for UNC paths in the ImageBaseDir setting. The workaround as mentioned above is to map a drive letter to the UNC share and use the resulting drive letter and path in the ImageBaseDir setting instead of the UNC share and path.
i did try that as well..
I mapped my UNC path to the media folder on the server (\\server.name\application\media) to L:\
After that i just put in <ImageBaseDir>L:\</ImageBaseDir> because L:\ already brings me to the media folder...
But still no juice...
getting the: File not found: /media/143096/international students.jpg. Double-check the ImageBaseDir setting in the ImageGen.config file.
I your previous post you also said that the virtual directory mapping and the imageBaseDir should be pointing to the same... I hope you mean that when creating the virtual directory i should also point to L:\ right? But the problem is, that IIS doesnt recognize the mapped drive.. So there i can only use the UNC path to the media folder...
It's a bit frustrating. :-)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted