Resize depending on User Input Support
How can I edit Smart Image Processor in such a way, that the width and height for resizing are determined by User Input?
Because you need to have images in different sizes for different parts of your website, you have multiple pages in your website that all do the same: Upload and Resize, but to different widths and heights.
Ever wanted to have one page in your site where you can do all of the Uploading and Resizing? Now you can! You can add two fields in which users can enter the width and height to which the image should be resized. This is how it is done:
Create a form and besides a File Field for selecting the upload file, add two Text Fields labelled Width and Height. In this example the field are named mywidth and myheight.
Now apply the Pure Upload and the Smart Image Processor like you normally would. Switch to Code View and find the code that was entered for the Smart Image Processor. If there is only one SIP attached, it should be named sip1. Find the line for the sip1.Resize. The first number is the width entered, the second value is the height. Edit the code like this:
sip1.Resize UploadFormRequest("mywidth"), UploadFormRequest("myheight"), true
Save your file and upload it.
Note: When you try opening the SIP from Server Behaviors for editing and wanting to close it again, the following error will occur: invalid value used for resize. Either put in some dummy value, click OK and change the code in Code View again or edit the settings of your choice in Code View.
That's basically it. Preview the result on a live page and see what happens!
I'd really appreciate your feedback on your results! If you have any more questions just let me know!