Resize for two different images
I want to allow the user to upload two images and have them resized. How can I do that?
Answer:
Firstly, you have to add the following code on top of your page after inserting Pure PHP Upload and Smart Image Processor for a single form:
<?php
if(isset($_POST["imagetype"]))
{
switch ($_POST["imagetype"])
{
case "Portrait" : $h = 480;
$w = 640;
break;
case "Landscape": $h = 640;
$w = 512;
break;
}
}
else
{
$h = 480;
$w = 640;
}
?>
Do not forget to change the following variable in SIP code block from
$sipp2->resize(640, 480, false);
to$sipp2->resize($h, $w, false);
Final designer decision is to make a select type where $_POST["imagetype"] variable is selected by the user. I have decided to make it with a list:
<select name="imagetype" id="imagetype">
<option value="Portrait">Portrait</option>
<option value="Landscape">Landscape</option>
</select>
Of course feel free to make it with another method - radio buttons for example.
DISCLAIMER:
This is extra complimentary content which purpose is to show additional usage that is not part of the product, i.e. it suggests tips for extending the functionality of the product by the users themselves.
It is provided "as is", without warranty of any kind, express or
implied , including but not limited to the warranties of
merchantability, fitness for a particular purpose and nonfringement of
third party rights.
DMXzone does not take responsibility to
support the suggested content to be fully compatible and working as
intended and does not provide support for extended functionality which
is not included in the current release of the extension.
It is highly recommended that only more advanced developers use it.
Comments
Be the first to write a comment
You must me logged in to write a comment.