Page 5 of 8 First ... 34567 ... Last
  • Jump to page:
    #61
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Location
    Dalas, TX
    Posts
    9
    Rep Power
    0
    Originally Posted by Shadow Wizard
    When you browse directly to the .ASPX file, what do you get?
    With some luck you'll get error and after some debugging we'll
    be able to sort it out quickly.
    When I browse directly to the .aspx file, I recieve an error message "missing image path" When I place the full path into the browser URL, I recieve "image file does not exist (check ASPNET permissions)" However, I am able to upload the file without issue using freeASPupload. I had to enable write permissions for the /images/ directory for that to work so I know the permissions are set to enable file creation. Even when I place the .aspx into the image directory and remove all the extra paths, I still get the "check ASPNET permissions" error.

    I am unable to add the first part of the URL due to being a new user, but here's the rest of the URL.

    dev.amea.us/dev/html/Images/ AnselBrush.jpg&thumb=dev.amea.us/dev/html/Images/ Ansel_thumb.jpg&width=250&height=-1

    Otherwise, when I run the code from the beginning, I don't get any error. It processes as though it was successful but does not generate a thumbnail. I'm logged into the filesystem as I'm testing. The strImageName is displayed but the strThumbName shows as a broken link even though the path and name is correct. I've seen other posts relating a similar story but no one describes how it was fixed. Thanks for any assistance you can provide, I appreciate it.
  2. #62
  3. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    Originally Posted by steve.davis-usa
    When I browse directly to the .aspx file, I recieve an error message "missing image path" When I place the full path into the browser URL, I recieve "image file does not exist (check ASPNET permissions)" However, I am able to upload the file without issue using freeASPupload. I had to enable write permissions for the /images/ directory for that to work so I know the permissions are set to enable file creation. Even when I place the .aspx into the image directory and remove all the extra paths, I still get the "check ASPNET permissions" error.

    I am unable to add the first part of the URL due to being a new user, but here's the rest of the URL.

    dev.amea.us/dev/html/Images/ AnselBrush.jpg&thumb=dev.amea.us/dev/html/Images/ Ansel_thumb.jpg&width=250&height=-1

    Otherwise, when I run the code from the beginning, I don't get any error. It processes as though it was successful but does not generate a thumbnail. I'm logged into the filesystem as I'm testing. The strImageName is displayed but the strThumbName shows as a broken link even though the path and name is correct. I've seen other posts relating a similar story but no one describes how it was fixed. Thanks for any assistance you can provide, I appreciate it.
    OK, I've added some debugging options into the code, download
    the new code from the first post in this thread and unzip.
    (Changes are in the ImageResizer.aspx file itself)

    With the new code, type this into your browser and tell me what you get:
    http://www.yoursite.com/ImageResizer.aspx?image=Images%2fAnselBrush.jpg&wi dth=250&virtual=1&debug=j1Ma82Pkl5xZ9

    Note, when you type directly into the browser you must Encode
    the values, thus the character "/" becomes %2f otherwise
    it won't work..
    Last edited by Shadow Wizard; October 17th, 2010 at 11:14 AM.
  4. #63
  5. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Location
    Dalas, TX
    Posts
    9
    Rep Power
    0
    Originally Posted by Shadow Wizard
    OK, I've added some debugging options into the code, download
    the new code from the first post in this thread and unzip.
    (Changes are in the ImageResizer.aspx file itself)

    With the new code, type this into your browser and tell me what you get:
    path blocked on reply
    Images%2fAnselBrush.jpg&width=250&virtual=1&debug= j1Ma82Pkl5xZ9

    Note, when you type directly into the browser you must Encode
    the values, thus the character "/" becomes %2f otherwise
    it won't work..
    Got image path: AnselBrush.jpg
    Parsing virtual path to actual disk path..
    Image file exists!
    Missing thumbnail path, using default..
    Thumbnail path is now: CORRECT-PATH\dev\html\images\AnselBrush_thumb.jpg
    OK

    NOTE: I don't understand what changed, but it's working properly now!!! THANK YOU!!
  6. #64
  7. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Location
    Dalas, TX
    Posts
    9
    Rep Power
    0
    Originally Posted by steve.davis-usa
    Got image path: AnselBrush.jpg
    Parsing virtual path to actual disk path..
    Image file exists!
    Missing thumbnail path, using default..
    Thumbnail path is now: CORRECT-PATH\dev\html\images\AnselBrush_thumb.jpg
    OK

    NOTE: I don't understand what changed, but it's working properly now!!! THANK YOU!!
    Well apparently I spoke to soon!! If I run the URL including the debug code, it works great, but if I ommit the debug code it still does not create the thumbnail. Any thoughts?
  8. #65
  9. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Location
    Dalas, TX
    Posts
    9
    Rep Power
    0
    Originally Posted by steve.davis-usa
    Well apparently I spoke to soon!! If I run the URL including the debug code, it works great, but if I ommit the debug code it still does not create the thumbnail. Any thoughts?
    I finally did get it to create the thumb image from within my .asp code. It was completely related to the source file naming convention. Once I finally got that correct, the .aspx generated the _thumb just fine. I'm integrating ImageResizer.aspx into FreeASPupload so I'm getting a bit creative in my efforts to make it work properly. Most of my issues likely due to my lack of experience as a programmer. However, I have it working correctly absent the issue described below.

    However, when I issue the command "objFso.MoveFile thumb, newname" it fails with an error saying the thumb does not exists. But when I look, it's there - I think everything is happening so FAST that the MoveFile command is attempting to move it before the file is fully created. If I do a page refresh it works fine. Is there any way to add a delay option at the very end of the .aspx file? i.e. ?delay=2 or something like that?
  10. #66
  11. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    Hmm.... glad you finally have it working mate!
    What exactly do you mean by "source file naming convention" though?
    Might help others with similar problem, as unlikely as it might be..

    Regarding MoveFile you're correct.. your XMLHTTP call is not
    waiting for the response thus the file is not "ready". To fix
    this, change the last parameter in this line in your code:
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1", True
    To be False instead which means "wait for the response":
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1", False
  12. #67
  13. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jun 2006
    Posts
    24
    Rep Power
    0
    Great script, looking to resize a GIF to JPEG (will actually edit the resizer so it will resize JPG to JPG, GIF to GIF, etc)

    It outputs this error trying to convert a transparent GIF to a JPG:

    A Graphics object cannot be created from an image that has an indexed pixel format

    Not sure how to solve this on this script, any ideas?


    While I'm asking, how do I change the script so it overwrites the original file - ie I want to pass in myimage.jpg and save it as myimage.jpg - it doesn't seem to be overwriting it.
  14. #68
  15. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Location
    Dalas, TX
    Posts
    9
    Rep Power
    0

    Thumbs up


    Originally Posted by Shadow Wizard
    Hmm.... glad you finally have it working mate!
    What exactly do you mean by "source file naming convention" though?
    Might help others with similar problem, as unlikely as it might be..

    Regarding MoveFile you're correct.. your XMLHTTP call is not
    waiting for the response thus the file is not "ready". To fix
    this, change the last parameter in this line in your code:
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1", True
    To be False instead which means "wait for the response":
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1", False
    Thanks again Shadow Wiz for helping me get past my own mistakes. I now have a perfectly working site where a user can upload a profile picture and have it auto-resized (thanks to your very cool code). One of the biggest issues that I was having was that the _thumb image was not getting created at all and I had seen several other post on this board indicating the same issue. The problem was that my source or original image was not being found by the objXML.Open "GET" command used in the ReSizer.aspx call being made from my classic asp page. Once I figured out the correct syntax, it work perfectly.

    For example, if "MyFile" contained the name of the image that was uploaded using freeASPUpload, I was not including it properly in the objXML.Open call to the .aspx code. What worked for me was to format the call as follows:

    <snip>?image="& MyFile &"&width=200<snip>

    I was trying to call is as:

    <snip>?image=(MyFile)&width=200<snip>

    My second problem was that the code used to rename the thumbname to something more unique such as the users userid. This would only work if I refreshed the browser. It was like the _thumb image was still being created while my rename code was attempting to rename a _thumb that didn't quite exist yet. Once again, you came to my rescue while I was off trying to figure out a less effective way to force it to work. The , False change to ,True at the end of the objXML.Open call to .aspx worked like a charm.

    I truely appreciate your help and the GIFT of this great utility. If anyone on this board is trying to get ImageResizer to work with freeASPUpload, I'll be happy to offer a few tips that worked for me.

    Happy Coding
  16. #69
  17. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    Originally Posted by jazzy639
    Great script, looking to resize a GIF to JPEG (will actually edit the resizer so it will resize JPG to JPG, GIF to GIF, etc)

    It outputs this error trying to convert a transparent GIF to a JPG:




    Not sure how to solve this on this script, any ideas?


    While I'm asking, how do I change the script so it overwrites the original file - ie I want to pass in myimage.jpg and save it as myimage.jpg - it doesn't seem to be overwriting it.
    I fear my code is not supporting transparency, it's in the very core
    so can't be "fixed". I have tried to mess with this in the past and
    looked for something to handle transparent GIF images as well,
    but had no luck.

    This was long time ago, so if and when I'll try again and find something
    I'll surely update my code but until then I fear it's not possible.

    Regarding overwriting the original image it's easy though I wouldn't
    advice it: losing the original picture can't be undone. What if you
    have 1000x1000 image, you want it 100x100 but next year you
    will change your mind and want 200x200? Overwriting the original
    image, you won't be able to change your mind in the future.

    Anyhow, it's not my decision to make, so the most simple solution
    is changing this line in the .aspx file:
    Code:
    wrapper.Save(strThumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg, compressionLevel);
    To this instead:
    Code:
    wrapper.Save(strImagePath, System.Drawing.Imaging.ImageFormat.Jpeg, compressionLevel);
    The change is marked in bold.
  18. #70
  19. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    Originally Posted by steve.davis-usa
    Thanks again Shadow Wiz for helping me get past my own mistakes. I now have a perfectly working site where a user can upload a profile picture and have it auto-resized (thanks to your very cool code). One of the biggest issues that I was having was that the _thumb image was not getting created at all and I had seen several other post on this board indicating the same issue. The problem was that my source or original image was not being found by the objXML.Open "GET" command used in the ReSizer.aspx call being made from my classic asp page. Once I figured out the correct syntax, it work perfectly.

    For example, if "MyFile" contained the name of the image that was uploaded using freeASPUpload, I was not including it properly in the objXML.Open call to the .aspx code. What worked for me was to format the call as follows:

    <snip>?image="& MyFile &"&width=200<snip>

    I was trying to call is as:

    <snip>?image=(MyFile)&width=200<snip>

    My second problem was that the code used to rename the thumbname to something more unique such as the users userid. This would only work if I refreshed the browser. It was like the _thumb image was still being created while my rename code was attempting to rename a _thumb that didn't quite exist yet. Once again, you came to my rescue while I was off trying to figure out a less effective way to force it to work. The , False change to ,True at the end of the objXML.Open call to .aspx worked like a charm.

    I truely appreciate your help and the GIFT of this great utility. If anyone on this board is trying to get ImageResizer to work with freeASPUpload, I'll be happy to offer a few tips that worked for me.

    Happy Coding
    Cheers Steve, I'm really glad that I could help you through this and
    big thanks for sharing this here!
  20. #71
  21. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2010
    Posts
    3
    Rep Power
    0

    Compiler Error


    Shadow Wizard,
    I keep getting this error on line 51 in the imageresizer.aspx file. Please help.

    Compiler Error Message: CS1525: Invalid expression term 'string'

    Source Error:



    Line 49: if (debugMode)
    Line 50: {
    Line 51: System.Collections.Generic.List<string> temp = new System.Collections.Generic.List<string>( strImagePath.Split(new char[] { '/', '\\' }));
    Line 52: temp.RemoveAt(temp.Count - 1);
    Line 53: string strFolderPath = string.Join("\\", temp.ToArray());
  22. #72
  23. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    You need .NET framework 2.0 or above installed on the server, you probably
    have 1.1 there which is not enough.
  24. #73
  25. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0
    Hi,

    Very cool code, especially that it can be integrated with classic ASP !

    However I am having some issue's with resizing by the classic asp method.

    If I give "strThumbName" the value: test.jpg it works.
    The thumbnail is generated.

    However, If I delete the test.jpg file and run the script again, it never creates test.jpg anymore ?

    If I then fill in: test2.jpg it does generate a new thumbnail.
    Also when I change the width it generates a new thumbnail.

    Also it does not overwrite the generated thumbnail if I run the script again ?

    Any idea's ? It looks like it is caching something ? But when I start the script from an other server, it still does not create the thumbnail ?
  26. #74
  27. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Location
    Israel
    Posts
    31,135
    Rep Power
    2921
    Yeah, it's cache problem indeed. Should have thought of that before.

    To solve this, first add this function to your ASP code:
    Code:
    Function GetTimeStamp()
    	Dim timeStamp, dtNow
    	dtNow = Now()
    	timeStamp = (1000 * Year(dtNow)) + (100 * Month(dtNow)) + (10 * Day(dtNow)) + CLng(Timer())
    	GetTimeStamp = timeStamp
    End Function
    Then change this line:
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1", True
    To this instead:
    Code:
    objXML.Open "GET", "http://localhost/ImageResizer.aspx?image=" & Server.MapPath(strImageName) & "&thumb=" & Server.MapPath(strThumbName) & "&width=500&height=-1&nnn=" & GetTimeStamp(), True
    Meaning add another URL parameter called "nnn" with the value of that function.

    This will cause unique URL on every request which means cache buster.
  28. #75
  29. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Nov 2010
    Posts
    4
    Rep Power
    0
    Yes, that works great ! Thanks alot !
Page 5 of 8 First ... 34567 ... Last
  • Jump to page:

Similar Threads

  1. ShadowResizer - image resize on the fly (classic ASP)
    By Shadow Wizard in forum Code Bank
    Replies: 23
    Last Post: June 26th, 2011, 01:51 AM
  2. vb: image resizing from stream to SQL Server
    By timandkids in forum .NET Development
    Replies: 0
    Last Post: November 10th, 2004, 11:54 AM
  3. Howto resize with stretch and save an image in jpg format?
    By zwonimir in forum Visual Basic Programming
    Replies: 3
    Last Post: August 24th, 2004, 06:08 AM
  4. resize external image.
    By telnoi in forum .NET Development
    Replies: 2
    Last Post: July 27th, 2004, 04:40 PM
  5. Image Resize Problem
    By adathelad in forum .NET Development
    Replies: 0
    Last Post: February 4th, 2004, 04:02 AM

IMN logo majestic logo threadwatch logo seochat tools logo