function processUpload($file, $username = null) { if (!$username) { $username = fpCurrentUsername(); } $tmpFile = $file["tmp_name"]; $mimeType = $file["type"]; $filename = utf8_decode($file["name"]); $filename = cleanupFilename($filename); $getcwd = getcwd(); $freeSpace = disk_free_space("/"); $uploaded = is_uploaded_file($tmpFile); $message = "OK"; if (!$uploaded) { return errorMessage("Uploaded file not found."); } //verify file type if (!startsWith($mimeType, "image")) { return errorMessage("Uploaded file {$filename} is not an image. ({$mimeType})"); } //move file to destination dir $dataRoot = getConfig("upload._diskPath"); $dataRootUrl = getConfig("upload.baseUrl"); createDir($dataRoot, $username); $uploadDir = combine($dataRoot, $username); $uploadedFile = combine($dataRoot, $username, $filename); $filesize = filesize($tmpFile); $success = move_uploaded_file($tmpFile, $uploadedFile); debug("move to {$uploadedFile}", $success); if (!$success) { return errorMessage("Cannot move file into target dir."); } return processImage($uploadDir, $filename); }
// make the directory if it doesn't exist mkdir(str_replace('//', '/', "{$docRoot}{$target_small}"), 0755, true); // make the directory if it doesn't exist move_uploaded_file($tempFile, $targetFile); $original_image = $targetFile; /************************************************************************************************************************* IF THE FILE IS A FLASH REDIRECT TO ANOTHER ORIGNAL SOURCE AND PREVENT DELETING IT **************************************************************************************************************************/ if ($file_ext == ".swf") { $delete_original = 'no'; $file_ext = '.jpg'; //$original_image = $docRoot."multimedia/pictures/template/admin.space/layout.pictures/no.preview.jpg"; $original_image = $docRoot . "multimedia/pictures/template/admin.space/icons/flash.icon.jpg"; } /************************************************************************************************************************* RESIZE ORIGINAL IMAGE IN MULTIPLE FORMATS **************************************************************************************************************************/ $final_image = "{$docRoot}{$target_large}{$name}"; processImage($original_image, $final_image, $large_height, $large_width, $file_ext); $final_image = "{$docRoot}{$target_medium}{$name}"; processImage($original_image, $final_image, $medium_height, $medium_width, $file_ext); $final_image = "{$docRoot}{$target_small}{$name}"; processImage($original_image, $final_image, $small_height, $small_width, $file_ext); /************************************************************************************************************************* DELETE THE ORIGINAL FILE TO REDUCE SPACE CONSUMPTION ON THE SERVER **************************************************************************************************************************/ if (file_exists($original_image) and $delete_original != 'no') { unlink($original_image); } } echo "1";
$shortsec = 'ch0' . $k; } else { $shortsec = 'ch' . $k; } $c = file_get_contents($folder . '/' . $shortsec . '.html'); //$c = file_get_contents($folder .'/'.$source.'.html'); $c = preg_replace('|</div>\\s*<div\\sid=navbar-bottom.*$|sm', '', $c); //$c = mb_convert_encoding($c,'windows-1252','UTF-8'); //remove copyrighted images $c = preg_replace('/<img[^>]*><div\\sclass="copyright".*?<\\/div>/sm', '', $c); $c = preg_replace('/<div[^>]*class="figure/', '<div style="text-align:center" class="figure', $c); preg_match_all('/<img[^>]*src="(.*?)"[^>]*width="(\\d+)"[^>]*>/', $c, $matches, PREG_SET_ORDER); $sl = strlen($source); foreach ($matches as $m) { if (substr($m[1], 0, $sl) == $source) { $newpath = processImage('./' . $folder . '/' . $m[1], $m[2], 0); $images[] = $newpath; $c = str_replace($m[0], '<a target="_blank" href="' . $webroot . $m[1] . '"><img src="' . $webroot . $newpath . '"/></a>', $c); } } preg_match('/<div\\s+class="chapter.*?>([^<>]+)<\\/h1>/sm', $c, $matches); $chp = $k; $chapters[$chp] = htmlentities(str_replace("\n", ' ', $matches[1]), ENT_XML1); $sections[$chp] = array(); $secind[$chp] = array(); $secparts = preg_split('/<div\\s+class="section.*?id="([^"]*)".*?>([^<>]+)<\\/h2>/sm', $c, -1, PREG_SPLIT_DELIM_CAPTURE); for ($j = 1; $j < count($secparts); $j += 3) { $sec = ($j + 2) / 3; $sections[$chp][$sec] = htmlentities(str_replace("\n", ' ', $secparts[$j + 1]), ENT_XML1); $secind[$chp][$sec] = substr_count($secparts[$j], '_') - 1; $zip->addFromString('wiki_content/Section' . $chp . '-' . $sec . '.html', fileize('<div class="section"><h2>' . $secparts[$j + 1] . '</h2>' . $secparts[$j + 2], $chp, $sec, $sections[$chp][$sec]));
function buildThumbnail($imageArray, $twidth, $theight) { $thumbs = array(); foreach ($imageArray as $image) { if ($image1 = processImage($image, $twidth, $theight, 0)) { $thumbs[] = "{$image1}"; } } return $thumbs; }
$homelayout[3][] = 1; } foreach ($homelayout as $k => $v) { $homelayout[$k] = implode(',', $v); } $perpage = intval($_POST['perpage']); if (isset($CFG['GEN']['fixedhomelayout']) && $CFG['GEN']['homelayout']) { $deflayout = explode('|', $CFG['GEN']['homelayout']); foreach ($CFG['GEN']['fixedhomelayout'] as $k) { $homelayout[$k] = $deflayout[$k]; } } $layoutstr = implode('|', $homelayout); if (is_uploaded_file($_FILES['stupic']['tmp_name'])) { processImage($_FILES['stupic'], $userid, 200, 200); processImage($_FILES['stupic'], 'sm' . $userid, 40, 40); $chguserimg = ",hasuserimg=1"; } else { if (isset($_POST['removepic'])) { deletecoursefile('userimg_' . $userid . '.jpg'); deletecoursefile('userimg_sm' . $userid . '.jpg'); $chguserimg = ",hasuserimg=0"; } else { $chguserimg = ''; } } $_POST['theme'] = str_replace(array('/', '..'), '', $_POST['theme']); $query = "UPDATE imas_users SET FirstName='{$_POST['firstname']}',LastName='{$_POST['lastname']}',email='{$_POST['email']}',msgnotify={$msgnot},qrightsdef={$qrightsdef},deflib='{$deflib}',usedeflib='{$usedeflib}',homelayout='{$layoutstr}',theme='{$_POST['theme']}',listperpage='{$perpage}'{$chguserimg} "; $query .= "WHERE id='{$userid}'"; mysql_query($query) or die("Query failed : " . mysql_error()); if (isset($_POST['dochgpw'])) {
$timelimitmult = '1.0'; } //echo $timelimitmult; if ($locked == 0) { $query = "UPDATE imas_students SET code={$code},section={$section},locked={$locked},timelimitmult='{$timelimitmult}',hidefromcourselist={$hide} WHERE userid='{$_GET['uid']}' AND courseid='{$cid}'"; mysql_query($query) or die("Query failed : " . mysql_error()); } else { $query = "UPDATE imas_students SET code={$code},section={$section},timelimitmult='{$timelimitmult}',hidefromcourselist={$hide} WHERE userid='{$_GET['uid']}' AND courseid='{$cid}'"; mysql_query($query) or die("Query failed : " . mysql_error()); $query = "UPDATE imas_students SET locked={$locked} WHERE userid='{$_GET['uid']}' AND courseid='{$cid}' AND locked=0"; mysql_query($query) or die("Query failed : " . mysql_error()); } require '../includes/userpics.php'; if (is_uploaded_file($_FILES['stupic']['tmp_name'])) { processImage($_FILES['stupic'], $_GET['uid'], 200, 200); processImage($_FILES['stupic'], 'sm' . $_GET['uid'], 40, 40); $chguserimg = "hasuserimg=1"; } else { if (isset($_POST['removepic'])) { deletecoursefile('userimg_' . $_GET['uid'] . '.jpg'); deletecoursefile('userimg_sm' . $_GET['uid'] . '.jpg'); $chguserimg = "hasuserimg=0"; } else { $chguserimg = ''; } } if ($chguserimg != '') { $query = "UPDATE imas_users SET {$chguserimg} WHERE id='{$_GET['uid']}'"; mysql_query($query) or die("Query failed : " . mysql_error()); } require "../header.php";
} else { $transDetails = "transition: Fx.Transitions.sineInOut"; } $filename = JPATH_SITE . DS . 'templates/' . $mainframe->getTemplate() . '/css/ja-slideshow.css'; $css_path = JURI::base() . 'templates/' . $mainframe->getTemplate() . '/css/'; if (!file_exists($filename)) { $css_path = JURI::base() . 'modules/mod_jaslideshow/ja_slideshow/'; } if ($autoresize && function_exists('imagecreatetruecolor')) { for ($i = 0; $i < count($imageArray); $i++) { if ($image1 = processImage($imageArray[$i], $swidth, $sheight)) { $imageArray[$i] = "'{$image1}'"; } } } if ($autoresize && ($image1 = processImage($firstImage, $swidth, $sheight))) { $firstImage = $image1; } JHTML::stylesheet('ja-slideshow.css', $css_path); echo '<div id="ja-slideshowwrap">' . "\n"; echo '<div id="ja-slideshow-case" class="ja-slideshow-case">' . "\n"; echo '<img src="' . JURI::base() . $firstImage . '" alt="' . $altimage . '" title="' . $altimage . '" />' . "\n"; echo '</div>' . "\n"; echo '<div class="ja-slideshow-mask"> </div>'; echo '<div id="ja-slidebar" class="ja-slidebar">' . "\n"; echo '</div>' . "\n"; echo '</div>' . "\n"; ?> <script type="text/javascript">
if (preg_match('/' . $shortsec . '-[^\\d]/', $filename)) { echo $filename; $c = file_get_contents($filename); } } //$c = file_get_contents($folder .'/'.$source.'.html'); $c = preg_replace('|</div>\\s*<div\\sid=navbar-bottom.*$|sm', '', $c); //$c = mb_convert_encoding($c,'windows-1252','UTF-8'); //remove copyrighted images $c = preg_replace('/<img[^>]*><div\\sclass="copyright".*?<\\/div>/sm', '', $c); $c = str_replace('<div class="figure', '<div style="width:500px;margin:auto;" class="figure', $c); preg_match_all('/<img[^>]*src="(.*?)"[^>]*>/', $c, $matches, PREG_SET_ORDER); $sl = strlen($source); foreach ($matches as $m) { if (substr($m[1], 0, $sl) == $source) { $newpath = processImage('./' . $folder . '/' . $m[1], 500, 400); $images[] = $newpath; $c = str_replace($m[0], '<a target="_blank" href="' . $webroot . $m[1] . '"><img src="' . $webroot . $newpath . '"/></a>', $c); } } preg_match('/<div\\s+class="chapter.*?>([^<>]+)<\\/h1>/sm', $c, $matches); //for ($i=1;$i<count($parts);$i+=2) { $chp = $k; $chapters[$chp] = htmlentities(str_replace("\n", ' ', $matches[1]), ENT_XML1); $sections[$chp] = array(); $secind[$chp] = array(); $secparts = preg_split('/<div\\s+class="section.*?id="([^"]*)".*?>([^<>]+)<\\/h2>/sm', $c, -1, PREG_SPLIT_DELIM_CAPTURE); for ($j = 1; $j < count($secparts); $j += 3) { $sec = ($j + 2) / 3; $sections[$chp][$sec] = htmlentities(str_replace("\n", ' ', $secparts[$j + 1]), ENT_XML1); $secind[$chp][$sec] = substr_count($secparts[$j], '_') - 1;
$inputImage = imagecreatefromjpeg("2K9Ef.jpg"); break; case 5: $inputImage = imagecreatefromjpeg("aVZhC.jpg"); break; case 6: $inputImage = imagecreatefromjpeg("FWhSP.jpg"); break; case 7: $inputImage = imagecreatefromjpeg("roemerberg.jpg"); break; default: exit; } // Process the loaded image $topNspots = processImage($inputImage); imagejpeg($inputImage); imagedestroy($inputImage); // Here be functions function processImage($image) { $orange = imagecolorallocate($image, 220, 210, 60); $black = imagecolorallocate($image, 0, 0, 0); $red = imagecolorallocate($image, 255, 0, 0); $maxX = imagesx($image) - 1; $maxY = imagesy($image) - 1; // Parameters $spread = 1; // Number of pixels to each direction that will be added up $topPositions = 80; // Number of (brightest) lights taken into account
<li class="active"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Menu<span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="upload-main.html">Go to Upload</a></li> <li><a href="#">Go to Count Info</a></li> <li><a href="#">Image Log</a></li> <li><a href="currency-type.html">Currency Type</a></li> <li><a href="about.html">About</a></li> </ul> </li> </ul> </div> </div> </div> <!-- Changer Counter Logo --> <div class="row"> <p><a href="index.html"><img src="http://i.imgur.com/azo1zCc.png" style="width:250px;height:104px;top-padding:50px"/></a></p> </div> <div class ="container" id="input"> <div class="jumbotron" style="width:100%;height:100%;padding-top:3px"> <section class="main-content" style="color:#0099ff;text-align:left;margin:20px"> <h1> Results</h1> <p>'; processImage(); echo '</p> </section> </div> </div> </body> </html>';
executePreparedSQLQuery($mysqlConn, 'UPDATE apps SET name = ?, version = ?, description = ?, category = ?, subcategory = ?, webicon = ?, publishstate = ? WHERE guid = ?', 'sisiisis', [$appName, $publishState === 1 ? $versionId : $currentVersionId, $appDescription, $appCategory, $appSubCategory, $webIconBlob->url, $publishState, $guid]); } else { //Update app row, but keep current version and publish state $publishState = $currentPublishState; executePreparedSQLQuery($mysqlConn, 'UPDATE apps SET name = ?, description = ?, category = ?, subcategory = ?, webicon = ? WHERE guid = ?', 'ssiiss', [$appName, $appDescription, $appCategory, $appSubCategory, $webIconBlob->url, $guid]); } } unset($_SESSION['publish_app_guid' . $_POST['guidid']]); for ($i = 1; $i <= getConfigValue('downloadmii_max_screenshots'); $i++) { //If screenshot is uploaded... if ($screenshotsUploaded[$i - 1]) { //...push it to storage and insert/update a database row for it $appScreenshotBlob = new blob(); $processedScreenshotHandle = processImage($_FILES['scr' . $i]['tmp_name'], 'screenshot'); $appScreenshotBlob->upload($blobRestProxy, getConfigValue('azure_container_screenshots'), stream_get_meta_data($processedScreenshotHandle)['uri']); $appScreenshotBlob->closeFileHandle(); executePreparedSQLQuery($mysqlConn, 'INSERT INTO screenshots (appGuid, imageIndex, url) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE url = ?', 'siss', [$guid, $i, $appScreenshotBlob->url, $appScreenshotBlob->url]); } //Delete screenshots if desired if (deletingFile('scr' . $i)) { $matchingScreenshotsToDelete = getArrayFromSQLQuery($mysqlConn, 'SELECT url FROM screenshots WHERE appGuid = ? AND imageIndex = ?', 'si', [$guid, $i]); if (count($matchingScreenshotsToDelete) === 1) { //Delete screenshot from database executePreparedSQLQuery($mysqlConn, 'DELETE FROM screenshots WHERE appGuid = ? AND imageIndex = ?', 'si', [$guid, $i]); //Get screenshot blob name from URL