$firstCount = substr($firstFrame, 1); $lastCount = substr($lastFrame, 1); $thumbIndex = substr($thumbnail, 1); // echo "<p>firstCount: $firstCount | lastCount: $lastCount | thumbIndex: $thumbIndex</p>"; if (!(($firstCount + $minFrames) < ($lastCount+2))) { echo "<p>Please select at least <b>$minFrames</b> frames.</p>" . "<p>First Frame: #$firstCount</p><p>Last frame: #$lastCount</p>" . $back; } else if (($lastCount - $firstCount) > $maxFrames) { echo "<p>Please select a range with a maximum of <b>$maxFrames</b> frames.</p>" . "<p>First Frame: #$firstCount</p><p>Last frame: #$lastCount</p>" . "<p>Selected range: " . ($lastCount - $firstCount) . " frames</p>" . $back; } else { // save thumb $imgFilesArray = getUserFiles($player_id."_", $wwwroot . $videoThumbsTempDir); $arrIndex = $thumbIndex-1; $thumbImg = $imgFilesArray[$arrIndex]; $fileName = $thumbImg[0]; $fileNoExt = substr($fileName, 0, strrpos($fileName, "_")); $fileExt = substr($fileName, strrpos($fileName, ".") + 1); $newName = $fileNoExt."_thumb.".$fileExt; $newFullPath = $wwwroot.$videoThumbsDir.$newName; copy($wwwroot.$videoThumbsTempDir.$fileName, $newFullPath); chmod($newFullPath, 0644); $thumbImg = '<img src="/'.$videoThumbsDir.$newName.'">'; ?> <?php echo getBoxTop("Thumbnail <span style='font-weight:normal;font-size:10px;'>(" . $videoThumbsDir . $newName . ")", 0, false, null); ?> <?php
$sqlnew = "UPDATE phpbb_users SET user_sig = '$postTextNew' where user_id = $postId"; // echo "<p>$sqlnew</p>"; $resnew = mysql_query($sqlnew); echo "<p>Updating sigs - Result: <b>$resnew</b></p>"; } // rename file $src = $imagesDir . $fileName; $dest = $imagesDir . $newName; echo "<p>Trying to rename $src to $dest... "; $renameWork = rename($src, $dest); chmod($dest, 0644); echo "<b>$renameWork</b></p>"; // update thumbnails $thumbsList = getUserFiles($fileNameNoExt . "_", $thumbsDir); foreach ($thumbsList as $thumbsArray) { $thumbName = $thumbsArray[0]; if (strstr($thumbName, $fileNameNoExt . "_200") > -1 || strstr($thumbName, $fileNameNoExt . "_300") > -1 || strstr($thumbName, $fileNameNoExt . "_400") > -1) { echo "<p>File: $thumbName Modified: $modified</p>"; $newExt = substr($thumbName, strlen($thumbName) - 8); $newName = $id . "_" . $modified . $newExt; echo "<p> - New thumb name: " . $newName . "</p>"; // update forum posts $sqlf = "SELECT post_id, post_text from phpbb_posts_text where post_text like '%$thumbName%'"; $resultf = mysql_query($sqlf); while ($rowf = mysql_fetch_array($resultf)) { $postId = $rowf[0]; $postText = $rowf[1]; $postTextNew = str_replace($thumbName, $newName, $postText); $postTextNew = addslashes($postTextNew);
if ($hasThumbnails) { break; } } if (!$hasThumbnails && $ext != "fm") { // generate them //echo "generate:$picName<p>"; generateThumb($imgDir, $picName, $ext, ""); //echo "ok:$picName<p>"; } else { //echo "n-ok:$picName<p>"; } } $thumbsList = getUserFiles($prefix, $thumbsDir); foreach ($filesList as $fileArray) { $fileThumbnails = array (); $filename = $fileArray[0]; $lastModified = $fileArray[1]; $picName = substr($filename, 0, strrpos($filename, ".")); $ext = substr($filename, strrpos($filename, ".") + 1); if (in_array_nocase($ext, $valid_picture_extensions)) { foreach ($thumbsList as $thumbsArray) { $thumbname = $thumbsArray[0]; $isThumbnail = (strstr($thumbname, $picName . "_") == $thumbname); if ($isThumbnail) { $fileThumbnails[] = $thumbname; } }