Server IP : 149.202.105.228 / Your IP : 216.73.216.18 Web Server : Apache System : Linux webm129.cluster030.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : atfycaf ( 116275) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/atfycaf/www/admin/ |
Upload File : |
<?php include "globalVars.php"; include "header.php"; ?> <h2>Upload a New Page Background - Home Page Photo</h2> <?php if (isset($_POST["uploadNewBG"])) { $photoTitleEN = $_POST["photoTitle_en"]; $pagesLock = $_POST["pagesLock"]; $pageURL = str_replace($badURL, $goodURL, $photoTitleEN); $pageURL = strtolower($pageURL) ; $dupQuery = mysqli_query($conn, "SELECT bgImage FROM pageBG WHERE bgImage = '$pageURL.jpg'"); $isDup = mysqli_num_rows($dupQuery); if ($isDup > 0) { $pageURL .= "-". ($isDup + 1); } $bgPhoto = $SERVER_ROOT ."/images/pagesBG/". $pageURL .".jpg"; $bgThumbPhoto = $SERVER_ROOT ."/images/pagesBG/". $pageURL ."-thumb.jpg"; $bgOrigPhoto = $SERVER_ROOT ."/images/pagesBG/". $pageURL ."-original.jpg"; $imageSQL = $pageURL .".jpg"; $pImgURL = $_POST["imgURL"]; $imgURL = $SERVER_ROOT ."/images/pagesBG/". $_POST["imgURL"]; $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $imageCrop = ($x2 - $x1)."x". ($y2 - $y1) ."+". $x1 ."+". $y1; $newSize = "1920x1080"; list($width, $height) = getimagesize($imgURL); $imgRatio = $width/$height; rename($imgURL, $bgOrigPhoto); if ($width != 1920) { exec("/usr/bin/convert -crop $imageCrop $bgOrigPhoto $bgPhoto"); exec("/usr/bin/convert -auto-orient -resize $newSize -strip -quality 75 -limit thread 2 $bgPhoto $bgPhoto"); } $newThumbWidth = $imageThumbWidth; $newThumbHeight = $newThumbWidth/$imgRatio; if ($newThumbHeight < $imageThumbHeight) { $newThumbHeight = $imageThumbHeight; $newThumbWidth = $imageThumbHeight * $imgRatio; } $newThSize = $newThumbWidth ."x". $newThumbHeight; $croppedThSize = "200x120+0+0"; exec("/usr/bin/convert -resize $newThSize $bgPhoto $bgThumbPhoto"); exec("/usr/bin/convert -gravity Center -crop $croppedThSize $bgThumbPhoto $bgThumbPhoto"); mysqli_query($conn, "INSERT INTO pageBG (pagesLock, bgImage, homeX1, homeY1, homeX2, homeY2) VALUES ('$pagesLock', '$imageSQL', '$x1', '$y1', '$x2', '$y2')"); $bgID = mysqli_insert_id($conn); foreach($langURLArray as $dbLang) { $bgTitle = str_replace($encBad, $encGood, $_POST["photoTitle_".$dbLang]); if (trim($bgTitle) == "") { $bgTitle = $photoTitleEN; } mysqli_query($conn, "INSERT INTO pageBGTitle_". $dbLang ." (id, bgTitle) VALUES ('$bgID', '". addslashes($bgTitle) ."')") or die (mysqli_error($conn)); } $trackDate = date("Y-m-d H:i:s"); mysqli_query($conn, "INSERT INTO userActions (dateCreated, adminID, pageTracking, databaseUpdated, updateDetails) VALUES ('$trackDate', '$adminID', 'admin/pagesBGNew-1.html', 'pageBG', 'The User ". addslashes($adminName) ." <$adminEmail> created the new background slide ". addslashes($photoTitleEN) ."')"); ?> <form action="pagesBGNew-2.html" method="post" id="propertyNext"> <input type="hidden" name="bgID" value="<?php echo $bgID ?>" /> </form> <script type="text/javascript"> document.getElementById('propertyNext').submit(); </script> <?php } else { if (count($langArray) != 1) { ?> <div id="langSelector"> <?php foreach($langArray as $langArrayURL=>$langArrayDisplay) { ?> <a id="<?php echo $langArrayURL ?>Selector"<?php if ($langArrayURL == "en") {?> class="selectedLang"<?php } ?>><?php echo $langArrayDisplay ?></a> <?php } ?> </div> <?php } ?> <form action="pagesBGNew-1.html" method="post"> <input type="hidden" id="imgURL" name="imgURL" value="" /> <input type="hidden" id="x1" name="x1" value="-" /> <input type="hidden" id="y1" name="y1" value="-" /> <input type="hidden" id="x2" name="x2" value="-" /> <input type="hidden" id="y2" name="y2" value="-" /> <?php foreach($langArray as $langTab=>$langDisplay) { ?> <div class="descTab" id="<?php echo $langTab ?>SelectorTab"> <div class="pFormRow"> <div class="pFormTitle"><?php echo $langDisplay ?> Photo Title:</div> <div class="pFormInput"> <input type="text" name="photoTitle_<?php echo $langTab ?>" id="photoTitle_<?php echo $langTab ?>" size="50" value=""<?php if ($langTab == "en") {?> required<?php } ?> /> <div class="pFormLabel"> <label class="labelName"><?php echo $langDisplay ?> Photo Title:</label> </div> </div> </div> </div> <?php } ?> <div class="descStTab"> <div class="pFormRow"> <div class="pFormTitle">Limit to one page:</div> <div class="pFormSelect"> <select name="pagesLock"> <option value="0">Show on all pages</option> <?php $pageQuery = mysqli_query($conn, "SELECT * FROM pages_en ORDER BY id ASC") or die (mysqli_error()); while ($pQ = mysqli_fetch_array($pageQuery)) { $pageID = $pQ["id"]; $pageName = $pQ["menuTitle"]; ?> <option value="<?php echo $pageID ?>"><?php echo $pageName ?></option> <?php } ?> </select> <div class="pFormLabel"> <label class="labelName">Limit to one page:</label> </div> </div> </div> </div> <div class="descLogoBGTab"> <div id="areaSelectPreviewContainer"> <div id="areaSelectPreview"></div> </div> <div id="uploadForm"> <div class="pFormRow"> <div class="pFormTitle">Add Photo: <span class="infoButton"><img src="images/infoButton.png" width="14" height="14" alt="Help" title="Help" border="0" /><span>This photo <strong>MUST</strong> be a minimum size of 1920 x 630 pixels.<br />Photos smaller than this will be scaled up which will make them blurred and generally of poor quality</span></span></div> <span class="btn btn-success fileinput-button"> <span><strong>+</strong> Select photo...</span> <input id="fileupload" type="file" name="files[]" accept="image/*"> </span> </div> <div id="progress"> <div class="bar" style="width: 0%;"></div> </div> <div id="status"></div> </div> </div> <p id="resizeInstr">You can now crop the photo to the position you want to display on the home page. Above is a preview of how the photo will look. On the next page you can crop the photo for the property lists and other pages.<br><br><strong>If you cannot see all of the full size photo below, press CTRL + - (minus key) to zoom out. Press CTRL + 0 (zero key) to zoom back to normal size.</strong></p> <div class="descImgBGTab" id="uploadedPhoto"></div> <input type="submit" class="submitButton" name="uploadNewBG" value="Save new background" /> </form> <?php } ?> <?php include "footer.php"; ?>