tag:blogger.com,1999:blog-3830568175179922785.post3826470280321130828..comments2022-04-07T14:02:08.099+01:00Comments on EasierThan (Official Blog): Code Tip #3 - Classic ASP Image Resizer (with options for cropping, padding, colouring and saving)EasierThanhttp://www.blogger.com/profile/15456594590723465069noreply@blogger.comBlogger48125tag:blogger.com,1999:blog-3830568175179922785.post-91579262468005260602019-02-12T10:21:58.008+00:002019-02-12T10:21:58.008+00:00Hi Unknown,
Sounds like you have uncommented the ...Hi Unknown,<br /><br />Sounds like you have uncommented the section attempting to ensure the script is being called from its own server and in the instance of your production site, it isn't.<br /><br />But on your staging and dev boxes, maybe everything was on the same server?<br /><br />Hope that helps.<br /><br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-75844604282298285512019-02-11T21:38:06.870+00:002019-02-11T21:38:06.870+00:00I've implemented this with some modifications ...I've implemented this with some modifications to stream the image from a varbinary column in SQL server. It works very well on my dev box, as well as our staging server. When I deployed it to production, images are all broken, and I see 302 errors in the developer console in chrome. <br /><br />When I try to navigate directly to the .aspx URL, I get redirected to the website root. I've checked every IIS setting I can think of and they are the same one all 3 servers. <br /><br />Any advise/thoughts/past experiences with something like this?Anonymoushttps://www.blogger.com/profile/01085484974124953914noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-49571972495097037892018-02-06T11:06:26.480+00:002018-02-06T11:06:26.480+00:00Hi Martin,
Can you specify what error or issue yo...Hi Martin,<br /><br />Can you specify what error or issue you're getting and where it occurs?<br /><br />Best Regards,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-2662875568618747082018-02-06T10:16:35.362+00:002018-02-06T10:16:35.362+00:00Hi,
Any idea on how to make this work with filena...Hi,<br /><br />Any idea on how to make this work with filenames and paths with Swedish letters åäö?<br /><br />Thanks!<br /><br />/MartinMartin Chttps://www.blogger.com/profile/10126486892077770218noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-18929184617684448292017-06-23T07:26:06.158+01:002017-06-23T07:26:06.158+01:00Thanks for getting back to me, I can see on that l...Thanks for getting back to me, I can see on that link there is a maybe a png transaparency fix. I will give it a try, not too <br />important for current project.<br />Anyways, I thought I would help others by saving others hours off their life!!<br />Im running windows 2008 / IIS7.5 and whilst using the demo zip provided works straight out of the box, when I implemented it against <br />my image uploads folder, things fell over!<br />I started getting really weird xml parser error? and image would not be displayed. Argghhh.<br /><br />Eventually after quite a few hours I discovered it boiled down to permissions on the uploaded image.<br />If you http to the uploaded image, it would display fine in a browser, but when using Resize_Image.aspx called<br />from an ASP page, it must use different permissions?. If I manually added READ permissions for the IIS_IUSRS account to the uploaded image,<br />I noticed it worked!<br />Without waffling more, the crux of the problem is if you use a PHP uploader to upload you image, php uploads the file to where ever <br />upload_tmp_dir (PHP.ini) is pointing too, the default of this is usually C:\Windows\Temp, and then moves the file to the final upload <br />folder you would have set up.<br />Well it turns out that there is an issue with the PHP move, in that, once it has uploaded the file to upload_tmp_dir setting with OK<br />permissions, when it carries out the move, it then looses the OK permissions, and then Resize_Image.aspx wont be able to read the image and<br />falls over.<br />People have mentioned creating a seperate upload folder, with added permissions, but I didnt not wont to do this as working on live system.<br />Others mentioned adding specific permission to my default C:\Window\Temp, but again I did not want to mess about with permission on live box<br />(ASP Code has been 95% running fine for 10+ years now)<br /><br />So the answer which finally worked for me was to change my php upload code, specifically the move section<br /><br />if(move_uploaded_file($_FILES['FileInput']['tmp_name'], $UploadDirectory.$NewFileName ))<br /> {<br /> }<br /> <br />to now copy file instead, and then delete temp file after<br /><br /> <br /> if(copy($_FILES['FileInput']['tmp_name'], $UploadDirectory.$NewFileName))<br /> {<br /> //now delete tmp file<br /> unlink($_FILES['FileInput']['tmp_name']);<br /> <br /> }<br /> <br />The resuting copied file now has OK permisssions and Resize_Image.aspx reads this OK, no problems!!<br /><br />Hope this helps save someones sanity!<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-28181421702204753652017-06-22T09:25:37.535+01:002017-06-22T09:25:37.535+01:00Hello Anon,
I never got round to implementing the...Hello Anon,<br /><br />I never got round to implementing them, but you can find some thoughts on Pieter Cooreman's (the author of the original) website.<br /><br />http://www.imageresizing.quickersite.com/<br /><br />Regards,<br />Dave (not Anon)EasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-79364829516199288472017-06-22T08:30:39.756+01:002017-06-22T08:30:39.756+01:00Where is it possible to find transparency saving i...Where is it possible to find transparency saving issue update?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-58583037276737367842016-10-21T14:27:18.127+01:002016-10-21T14:27:18.127+01:00Hi Olaf,
Glad you solved the original problem. Co...Hi Olaf,<br /><br />Glad you solved the original problem. Could you perhaps include details of how it was solved for the benefit of anyone else reading who may be having a similar difficulty?<br /><br />The enclosed ASPX file contains a list of possible querystring parameters and advice regards using them?<br /><br />To use the option to save a file onto the server, you need to uncomment the relevant lines in the ASPX file as per the instructions within it.<br /><br />If you've followed the instructions and it isn't working, can you provide an example of what you're trying to do, again altering actual paths slightly for security purposes?<br /><br />Best Regards,<br />Dave<br />EasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-55478173318116291132016-10-21T13:06:43.202+01:002016-10-21T13:06:43.202+01:00Hi Dave,
problem solved - months ago :) Another Qu...Hi Dave,<br />problem solved - months ago :) Another Question: How can i resize and save an image in a folder on the server? Best Regards OlafAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-70252844174366455372016-06-27T10:13:37.060+01:002016-06-27T10:13:37.060+01:00Hi Olaf,
Without compromising security, can you b...Hi Olaf,<br /><br />Without compromising security, can you be more specific as to what your absolute path is? i.e. Change some of the characters.<br /><br />First thing to check would be whether your server settings allow a script to create files in that directory.<br /><br />Best Regards,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-16649573079697303082016-06-27T09:51:03.148+01:002016-06-27T09:51:03.148+01:00Thanks for providing that great script! Your origi...Thanks for providing that great script! Your original version works fine but when i enter absolute paths for the script file and the images no resized image ist displayed. Any ideas? Thanks. <br />Best Regards <br />OlafAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-70133430302723491092016-01-21T13:36:13.472+00:002016-01-21T13:36:13.472+00:00Nice thanks
http://www.codingsack.comNice thanks<br />http://www.codingsack.comAssmhttps://www.blogger.com/profile/03682012658542206285noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-69842713978065674082015-10-07T19:47:30.485+01:002015-10-07T19:47:30.485+01:00Hi Michal,
To my knowledge, it shouldn't requ...Hi Michal,<br /><br />To my knowledge, it shouldn't require anything additional setting up in IIS and IIS 7.5 is fine, as is .NET 2.0 upwards. And I wouldn't have thought the pipeline mode would matter.<br /><br />A 404 is a specific server response to say the file is not there. Is it possible it is something simple like you have renamed Resize_Image.aspx file, but not in your code or vice versa?<br /><br />Regards,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-52740214840092954872015-10-06T23:09:42.179+01:002015-10-06T23:09:42.179+01:00Hi Dave
I dont know what is wrong. When i use scr...Hi Dave<br /><br />I dont know what is wrong. When i use script on localserver (on WinXP and on Win7 too) it is working, but it dont want to work on Win2008 server. Need I to set some parameters on IIS 7.5? <br />Application pool is set to .NET Framework 2.0.50727, Classic Pipeline mode. I removed <%@ OutputCache Duration="600" VaryByParam="*" %><br /><br />When i try to open showthumb.aspx link i take answer:<br />404 - File or directory not found.<br /><br /><br />I thing i was successfull to use it mounth ago, but not now :( <br /><br />Thanx a lot<br />MichalAnonymoushttps://www.blogger.com/profile/14784478575886348757noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-25554921074607582612014-06-03T13:54:32.932+01:002014-06-03T13:54:32.932+01:00Hi Julius,
The FreeASPUpload site has an FAQ page...Hi Julius,<br /><br />The FreeASPUpload site has an FAQ page including "How do I grab the filename of the uploaded file?" and "How do I rename the uploaded file?": http://www.freeaspupload.net/freeaspupload/faq.asp<br /><br />My own solution is a little more complicated. I edited Public Property Get FileName() within freeASPUpload.asp to assign the nameOfFile to my own global variable and then set FileName = to my own choice of temporary filename, in your case a random number.<br /><br /> Public Property Get FileName()<br /> sMyGlobalVariable = nameOfFile<br /> FileName = "My_Filename.tmp"<br /> End Property<br /><br />Hope that helps.<br /><br />Regards,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-36783357002334772802014-06-02T21:23:46.728+01:002014-06-02T21:23:46.728+01:00Hi Dave,
I have researched this issue thoroughly...Hi Dave, <br /><br />I have researched this issue thoroughly and agree the current solution can't do what I am looking for. I think it would require additional plugins like flash, silverlight, html5, google gears etc ...Thanks for the assistance. One further question ..... how do I get access to the fileData array values in classic ASP? I want to add a random number each time a customer uploads a new image however I need to get hold of the image/filename. I am also using freeaspupload so perhaps that will help.<br /><br />Thanks Juliushttps://www.blogger.com/profile/12291699794381925890noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-60022322808082497232014-06-02T16:08:00.079+01:002014-06-02T16:08:00.079+01:00Hi Julius,
That isn't something I've trie...Hi Julius,<br /><br />That isn't something I've tried. Is there a reason you don't want the user to upload the file, such as anticipated size on upload?<br /><br />The solution in this post certainly can't be employed in that manner. I use a separate ASP script (http://www.freeaspupload.net) to upload the file and then use the solution in this post to resize it once it is on the server - where the aspx file can get at it.<br /><br />Anyone else out there used JQuery in this manner and care to advise?<br /><br />Cheers,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-35830712210664726532014-06-01T23:51:46.862+01:002014-06-01T23:51:46.862+01:00Hi Dave, yes my pages are in classic ASP. My custo...Hi Dave, yes my pages are in classic ASP. My customers typically upload all sizes of images both in bytes as well as dimensions. However I want to standardize the size of images on our website so I figured I could 1) limit the file size and 2) resize images before upload to a standard size say: 200px by 200px. The file size limit I can do however it is the resizing that I am more interested in. Juliushttps://www.blogger.com/profile/12291699794381925890noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-67970390270689566272014-06-01T19:22:04.809+01:002014-06-01T19:22:04.809+01:00Hi Julius,
In order to resize on the client side,...Hi Julius,<br /><br />In order to resize on the client side, you would need access to the client's hard drive? Is that what you're looking for?<br /><br />Can you explain what you're trying to do? Are your pages in Classic ASP?<br /><br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-44083450758473056372014-06-01T16:00:32.372+01:002014-06-01T16:00:32.372+01:00Hi Dave, I meant before uploading to the server. I...Hi Dave, I meant before uploading to the server. I have seen some plugins such as the jquery file upload (jQuery File Upload Demo - blueimp) claim that they can resize the image on the client side before uploading to the server.Juliushttps://www.blogger.com/profile/12291699794381925890noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-9905151623582422762014-06-01T10:53:50.122+01:002014-06-01T10:53:50.122+01:00Hi Julius,
Can you explain what you mean? Do you ...Hi Julius,<br /><br />Can you explain what you mean? Do you mean during the upload process or locally on the user's machine?<br /><br />The first isn't possible with the code. The second would require you to be running IIS locally on the user's machine with the code installed there.<br /><br />Regards,<br />DaveEasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-70463673213699999172014-06-01T10:52:55.091+01:002014-06-01T10:52:55.091+01:00This comment has been removed by the author.EasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-73442543066175292602014-06-01T02:12:54.004+01:002014-06-01T02:12:54.004+01:00Hi Dave, so far so good. Excellent work!!! I want ...Hi Dave, so far so good. Excellent work!!! I want to resize the images before I upload to the server. Any suggestions? I will appreciate if you have code where you have done it before. Thanks in advance.Juliushttps://www.blogger.com/profile/12291699794381925890noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-53050327912325129062014-02-13T19:20:14.057+00:002014-02-13T19:20:14.057+00:00No worries. Glad to help and to know there are sti...No worries. Glad to help and to know there are still plenty of us about who are quite happy with good old ASP.<br /><br />Credit due to the original author, Pieter Cooreman, too!EasierThanhttps://www.blogger.com/profile/15456594590723465069noreply@blogger.comtag:blogger.com,1999:blog-3830568175179922785.post-75856854235944088592014-02-12T18:41:45.120+00:002014-02-12T18:41:45.120+00:00Thanks Dave, that makes total sense, and I probabl...Thanks Dave, that makes total sense, and I probably should have seen that. I really appreciate your fast replies. The Classic ASP Image Resizer really is a great addition to my classic ASP library.Debugnoreply@blogger.com