Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Phil 4 posts 24 karma points
    Jul 31, 2012 @ 17:04
    Phil
    0

    Unable to get the ImageBaseDir working on localhost

    Hi there, 

     

    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

    <ImageBaseDir>/media</ImageBaseDir>

    Im not missing the ashx file.

    I have set it up in web.config.

     

    Any ideas?

    Thanks a lot.

  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Jul 31, 2012 @ 17:20
    Douglas Robar
    0

    Hi, Phil,

    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:

    http://localhost/imagegen.ashx?image=someimage.jpg&width=100&class=phil

     

    cheers,
    doug. 

  • Phil 4 posts 24 karma points
    Jul 31, 2012 @ 17:32
    Phil
    0

    Hi Doug

    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.

    Thanks

    Phil

  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Jul 31, 2012 @ 17:46
    Douglas Robar
    0

    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.

    cheers,
    doug. 

  • Phil 4 posts 24 karma points
    Jul 31, 2012 @ 18:10
    Phil
    0

    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.

    http://localhost/ImageGen.ashx?image=/media/someimage.jpg&width=107&height=91

    I have also tried <ImageBaseDir>http://localhost/media</ImageBaseDir>; where I get the following

    The remote server returned an error: (404) Not Found.

    http://localhost/ImageGen.ashx?image=/media/someimage.jpg&width=107&height=91

     

    Thanks,

    Phil

  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Jul 31, 2012 @ 19:12
    Douglas Robar
    0

    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.

    cheers,
    doug. 

  • Phil 4 posts 24 karma points
    Aug 01, 2012 @ 13:28
    Phil
    0

    Brilliant thats where I was going wrong. 

     

    Thank you Doug Great help!

  • Vishal G.P 62 posts 122 karma points
    Apr 16, 2013 @ 13:01
    Vishal G.P
    0

    Hey Guys,

    i know this is an old thread, but i have the same problem....

    using: ImageGen Professional version 2.5.7.27945 

    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: 

    http://site.local/umbraco/imagegen.aspx?image=/media/69107%2frdm.jpg&class=media&width=367&height=97

    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">

       <AllowUpsizing>false</AllowUpsizing>

    </Class>

    <Class Name="media" OverridesQueryString="true">

    <ImageBaseDir>\\server.name\application\media</ImageBaseDir>

    </Class>

     

    What am i doing wrong??

     

    thanks in advance... is UNC paths allowed in this version?

     


  • Douglas Robar 3570 posts 4670 karma points MVP 6x admin c-trib
    Apr 17, 2013 @ 16:40
    Douglas Robar
    0

    Hi Vishal,

    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.

    cheers,
    doug. 

  • Vishal G.P 62 posts 122 karma points
    Apr 17, 2013 @ 16:59
    Vishal G.P
    0

    Hi Douglas,

    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. :-)

     

     

     




Please Sign in or register to post replies

Write your reply to:

Draft