
Chrisj
Members-
Posts
547 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Chrisj
-
Thanks for your reply. Sorry for any confusion. "session_start()" appears in my initial posting. I'm trying to "have a User’s profile page only display to Users who are logged into the site", and not have any profile pages display in any web searches (only be available to display to logged in users). any additional help is appreciated
-
Thanks again for your reply. Here's the .htaccess file: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^$ index.php?link1=home [NC,QSA] RewriteRule ^reset-password/([^\/]+)(\/|)$ index.php?link1=reset-password&code=$1 [NC,QSA] RewriteRule ^confirm/(.*)/(.*)$ index.php?link1=confirm&code=$1&email=$2 [NC,QSA] RewriteRule ^two_factor_login/$ index.php?link1=two_factor_login [NC,QSA] RewriteRule ^two_factor_submit/$ index.php?link1=two_factor_submit [NC,QSA] RewriteRule ^v/(.*)$ index.php?v=$1 [NC,QSA] RewriteRule ^api/v(([0-9])([.][0-9]+))(\/|)$ api.php?v=$1 [QSA] RewriteRule ^admin-cp$ admincp.php [NC,QSA] RewriteRule ^admin-cp/(.*)$ admincp.php?page=$1 [NC,QSA] RewriteRule ^admin-cdn/(.*)$ admin-panel/$1 [L] RewriteRule ^videos/category/(.*)/rss(\/|)$ index.php?link1=videos&page=category&id=$1&feed=rss [NC,QSA] RewriteRule ^videos/category/(.*)/(.*)$ index.php?link1=videos&page=category&id=$1&sub_id=$2 [NC,QSA] RewriteRule ^videos/category/(.*)$ index.php?link1=videos&page=category&id=$1 [NC,QSA] RewriteRule ^videos/(.*)/rss(\/|)$ index.php?link1=videos&page=$1&feed=rss [NC,QSA] RewriteRule ^videos/(.*)$ index.php?link1=videos&page=$1 [NC,QSA] RewriteRule ^articles(\/|)$ index.php?link1=articles [NC,QSA] RewriteRule ^articles/category/(.*)(\/|)$ index.php?link1=articles&category_id=$1 [NC,QSA] RewriteRule ^articles/read/(.*)(\/|)$ index.php?link1=read&id=$1 [NC,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^aj/([^/.]+)/?$ ajax.php?type=$1&first=$2 [L,QSA] RewriteRule ^aj/([^/.]+)/([^/.]+)/?$ ajax.php?type=$1&first=$2 [L,QSA] RewriteRule ^aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ ajax.php?type=$1&first=$2&second=$3 [L,QSA] RewriteRule ^edit-video/(.*)?$ index.php?link1=edit-video&id=$1 [L,QSA] RewriteRule ^watch/([^\/]+)(\/|)?$ index.php?link1=watch&id=$1 [L,QSA] RewriteRule ^watch/([^\/]+)/list/([^\/]+)(\/|)?$ index.php?link1=watch&id=$1&list=$2 [L,QSA] RewriteRule ^embed/(.*)?$ index.php?link1=embed&id=$1 [L,QSA] RewriteRule ^resend/(.*)/(.*)?$ index.php?link1=resend&id=$1&u_id=$2 [L,QSA] RewriteRule ^redirect/(.*)?$ index.php?link1=redirect&id=$1 [L,QSA] RewriteRule ^settings/(.*)/(.*)$ index.php?link1=settings&page=$1&user=$2 [NC,QSA] RewriteRule ^settings/(.*)$ index.php?link1=settings&page=$1 [NC,QSA] RewriteRule ^terms/([^\/]+)(\/|)$ index.php?link1=terms&type=$1 [QSA] RewriteRule ^go_pro(\/|)$ index.php?link1=go_pro [QSA] RewriteRule ^ads(\/|)$ index.php?link1=ads [QSA] RewriteRule ^ads/create(\/|)$ index.php?link1=create_ads [QSA] RewriteRule ^ads/edit/(\d+)(\/|)$ index.php?link1=edit_ads&id=$1 [QSA] RewriteRule ^ads/analytics/(\d+)(\/|)$ index.php?link1=ads_analytics&id=$1 [QSA] RewriteRule ^contact-us(\/|)$ index.php?link1=contact [QSA] RewriteRule ^@([^\/]+)(\/|)$ index.php?link1=timeline&id=$1 [QSA] RewriteRule ^messages/(.*)$ index.php?link1=messages&id=$1 [NC,QSA] RewriteRule ^view_analytics/(.*)$ index.php?link1=view_analytics&id=$1 [NC,QSA] RewriteRule ^video_studio/(.*)$ index.php?link1=video_studio [NC,QSA] RewriteRule ^comments/$ index.php?link1=comments [NC,QSA] RewriteRule ^dashboard/$ index.php?link1=dashboard [NC,QSA] RewriteRule ^popular_channels/$ index.php?link1=popular_channels [NC,QSA] RewriteRule ^create_article/$ index.php?link1=create_article [NC,QSA] RewriteRule ^my_articles/$ index.php?link1=my_articles [NC,QSA] RewriteRule ^edit_articles/(.*)?$ index.php?link1=edit_articles&id=$1 [NC,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^\/]+)(\/|)$ index.php?link1=$1 [QSA] <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/opentype BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule> <IfModule mod_security.c> SecFilterScanPOST Off </IfModule> ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 190 days" </IfModule> ## EXPIRES CACHING ## # BEGIN cPanel-generated php ini directives, do not edit # Manual editing of this file may result in unexpected behavior. # To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor) # For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI) <IfModule php7_module> php_value post_max_size 2024M php_value upload_max_filesize 2024M php_value output_buffering Off php_value max_execution_time 4000 php_value max_input_vars 3000 php_value max_input_time 5000 php_flag zlib.output_compression Off php_flag log_errors On php_value error_reporting 32767 php_value error_log "/home/.../public_html/error_log" </IfModule> <IfModule lsapi_module> php_value post_max_size 2024M php_value upload_max_filesize 2024M php_value output_buffering Off php_value max_execution_time 4000 php_value max_input_vars 3000 php_value max_input_time 5000 php_flag zlib.output_compression Off php_flag log_errors On php_value error_reporting 32767 php_value error_log "/home/.../public_html/error_log" </IfModule> # END cPanel-generated php ini directives, do not edit I look forward to any additional assistance
-
Thanks for your reply, but, I'd have to guess. Maybe this: RewriteRule ^([^\/]+)(\/|)$ index.php?link1=$1 [QSA] or this? RewriteRule ^v/(.*)$ index.php?v=$1 [NC,QSA] or this? RewriteRule ^$ index.php?link1=home [NC,QSA] or? RewriteRule ^aj/([^/.]+)/([^/.]+)/([^/.]+)/?$ ajax.php?type=$1&first=$2&second=$3 [L,QSA] another bit of information, when i asked the script's developer "I want to keep the User account page from displaying in web searches... with ”noindex”..., he said to use this in the html: $pt->second_page == ‘about’ I don't know if that is at all helpful. Any additional suggestions is appreciated
-
The php web video script that I’m using displays a User’s profile page, by simply adding (for example) …/@UserName after the url into a browser. I tried to have a User’s profile page only display to Users who are logged into the site, by adding session code: if(!isset($_SESSION['username'])){ header("Location:../login"); exit(); } like so: <?php if(!isset($_SESSION['username'])){ header("Location:../login"); exit(); } if (empty($_GET['id'])) { header("Location: " . PT_Link('')); exit(); } $username = PT_Secure($_GET['id']); $user_id = $db->where('username', $username)->getOne(T_USERS); $lists = false; if (empty($user_id)) { header("Location: " . PT_Link('')); exit(); } $pt->page_url_ = $pt->config->site_url.'/@'.$username ; $pt->second_page = 'videos'; if (!empty($_GET['page'])) { switch ($_GET['page']) { case 'liked-videos': $pt->second_page = 'liked-videos'; break; case 'about': $pt->second_page = 'about'; break; case 'play-lists': $pt->second_page = 'play-lists'; $lists = true; break; } $pt->page_url_ = $pt->config->site_url.'/@'.$username."?page=".$pt->second_page; } $user_data = PT_UserData($user_id, array( 'data' => true )); etc... but was unsuccessful. The problem is although the …/@UserName no longer displays in the browser field (and redirects to the login page) (with that additional code), once logged in, the User can’t see his Profile Page either. I also tried adding this: if(!isset($_SESSION['username'])){ header("Location:../login"); print_r($_SESSION); exit; } but I see no printed results. I have tried this: <?php session_start(); if(!isset($_SESSION['username'])){ header("Location:../login"); exit(); } but, when I select the drop-down menu > profile, it just seems to refresh the same page (that I'm on, and doesn't take me to the ../@chrisj profile page, as it did before I added this: if(!isset($_SESSION['username'])){ header("Location:../login"); exit(); } Also, the .htaccess file shows this: RewriteRule ^@([^\/]+)(\/|)$ index.php?link1=timeline&id=$1 [QSA] if that is any clue. I went ahead and asked the developer, and he simply said: “Its happening because file is same so no remedy for now”. So, now I’m looking for ideas on what I might try as a work around. just FYI -When a user logs in it sets the $_SESSION[‘username’] variable, id, etc.) I’m guessing that maybe the main page that I’m on simply refreshes (rather than redirects to the ‘Profile’ Page) is because I am (already)logged in: if(!isset($_SESSION['username'])){ header("Location:../login"); So, is there a solution that might instruct to say something like 'if already logged in go to @ the username’s profile page? something like: if (IS_LOGGED == true) { any additional suggestions are welcomed
-
help with not showing php/html page in web search
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks for all the replies/help. how can I test to see if it successfully facilitates the user/member account pages not appearing in searches? -
help with not showing php/html page in web search
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks again for your reply/help. does this line have an extra ' in it, before the last " ? echo "<meta name='robots' content='noindex'>'"; if not, and this is valid code: <?php if ($pt->second_page == ‘about’) echo "<meta name='robots' content='noindex'>'"; ?> how can I test to see if it successfully facilitates the user/member account pages not appearing in searches? I look forward to any assistance. -
help with not showing php/html page in web search
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks for your reply. The developer provided this: $pt->second_page == ‘about’ based on the rest of the container.html code, I have added this: <?php if ($pt->second_page == ‘about’){ ?> <meta name="robots" content="noindex">} /> <?php } ?> does this code look valid? If so, how would I test? -
help with not showing php/html page in web search
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks for the replies. Yes, noindex. I had asked the web script author about this he replied: "You can place it in ./themes/layout/container.html you will need to use php code in order to load this meta only for profile page". I see the container.html <head> section and I believe the profile page is located at: /themes/default/layout/timeline/pages/about.html I just don't know how to put it altogether with this: <?php <meta name=”robots” content=”noindex”> ?> and additional guidance is appreciated -
help with not showing php/html page in web search
Chrisj replied to Chrisj's topic in PHP Coding Help
thanks for your replies. Regarding the url, I said "For example..." it was there as an example -
The php web video script that I'm using displays user/member account pages in google searches. For example, the url displaying the page is the https://webvideosite.com/@chrisj I'm looking for guidance/suggestions on how to have the user/member account pages not appear in searches, either by blocking that somehow, or only having access to it if you are logged into the site. I look forward to any replies
-
It was suggested that I add a ‘report’ parameter to the code, after revising with the ‘scale2ref’ code which appears to prevent the video from uploading/proceeding: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "[0]scale=426:-2[vid];[1][vid]scale2ref='oh*mdar':'ih/10'[wm][vid];[vid][wm]overlay=5:5:format=rgb,format=yuv420p" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 -report'.$video_output_full_path_240.' 2>&1'; $shell = shell_exec($ffmpegCommand); I couldn’t see where the -report parameter was supposed to output (error.log has a filesize of 0). So I was asked to “run command from the shell and check”? But, I’m not sure what command and where/how to do that. I tried adding this to the php code, and attempted to upload again, same result echo shell_exec("/usr/local/bin/ffmpeg -report log.txt 2>&1"); any additional help is appreciated Any guidance with that is appreciated.
-
When I asked about adding a watermark to a video, this was suggested: "when scaling it, I'd do h/5:w/5 (of the source video), then position would be w/20 (5% from the left) and h-h/3 (75% of the way down) When I asked about adding a watermark to a video, this was suggested: "when scaling it, I'd do h/5:w/5 (of the source video), then position would be w/20 (5% from the left) and h-h/3 (75% of the way down)" I'd like to try that, but I don't know how to integrate that into my existing working code: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=426:-2, overlay=10:10, " -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; I've looked at the ffmpeg documentation, but need additional assistance. any help is appreciated
-
As stated earlier, the php web video script that I’m modifying adds a watermark to uploaded videos. I’m trying to find a solution where the watermark image doesn’t look blurry in the ‘full screen’ mode. regarding these lines of code: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=426:-2, overlay=10:10, " -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; the script also has that line for 240, 360, 480, 720, 1080, 2048 and 4096 they all use the $watermark_image_full_path = "watermark.png"; would it be better to add a different watermark.png image for each size 240, 360, etc.? Any ideas or solutions to keep the image sharp not blurry upon resizing is welcomed
-
Thanks for your reply.After more research, I believe a potential solutions is to add the 'scale2ref' parameter to my existing ffmpeg code.I have tried different attempts with it without success. The documentation example shows:“Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio”:[logo-in][video-in]scale2ref=w=oh*mdar:h=ih/10[logo-out][video-out]I need guidance with integrating scale2ref into a current line of code, for example: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.escapeshellarg($watermark_image_full_path).' -i '.escapeshellarg($watermark_image_full_path).' -filter_complex "scale=426:-2, scale=426:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; any additional assistance is appreciated
-
Based on my posting where I provide the full code (above), would adding code so that 2 different watermark.png images are used, one for small screen, one for full screen, be a solution? If so, any guidance with that is appreciated. Also, is it workable to use an svg file as a watermark? I look forward to any assistance.
-
Thanks for your reply and link. I have looked over the link, and tried many attempts with no scaling. You said "resize the watermark stream before you overlay". Isn't my code already doing that? $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; any additional help is appreciated
-
Thanks again for your message. I'm not sure if the ffmpeg code above (which I didn't create) already had the ability to resize. As I stated earlier I look forward to any guidance on how to ffmpeg code assistance with scaling the image down to fit the video dimensions appropriately. Here's the full file code: <?php if (IS_LOGGED == false || $pt->config->upload_system != 'on') { $data = array( 'status' => 400, 'error' => 'Not logged in' ); echo json_encode($data); exit(); } else if ($pt->config->ffmpeg_system != 'on') { $data = array( 'status' => 402 ); echo json_encode($data); exit(); } else { $getID3 = new getID3; $featured = ($user->is_pro == 1) ? 1 : 0; $filesize = 0; $error = false; if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) { if (empty($_POST['movie_title']) || empty($_POST['movie_description']) || empty($_FILES["movie_thumbnail"]) || empty($_POST['stars']) || empty($_POST['producer']) || empty($_POST['country']) || empty($_POST['quality']) || empty($_POST['rating']) || !is_numeric($_POST['rating']) || $_POST['rating'] < 1 || $_POST['rating'] > 10 || empty($_POST['release']) || empty($_POST['category']) || !in_array($_POST['category'], array_keys($pt->movies_categories))) { $error = $lang->please_check_details; } // $cover = getimagesize($_FILES["movie_thumbnail"]["tmp_name"]); // if ($cover[0] > 400 || $cover[1] > 570) { // $error = $lang->cover_size; // } } else{ $request = array(); $request[] = (empty($_POST['title']) || empty($_POST['description'])); $request[] = (empty($_POST['tags']) || empty($_POST['video-thumnail'])); if (in_array(true, $request)) { $error = $lang->please_check_details; } else if (empty($_POST['video-location'])) { $error = $lang->video_not_found_please_try_again; } else if (($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'pro_users' && $pt->user->is_pro) || ($pt->config->sell_videos_system == 'on' && $pt->config->who_sell == 'users') || ($pt->config->sell_videos_system == 'on' && $pt->user->admin)) { if (!empty($_POST['set_p_v']) || $_POST['set_p_v'] < 0) { if (!is_numeric($_POST['set_p_v']) || $_POST['set_p_v'] < 0 || (($pt->config->com_type == 0 && $_POST['set_p_v'] <= $pt->config->admin_com_sell_videos)) ) { $error = $lang->video_price_error." ".($pt->config->com_type == 0 ? $pt->config->admin_com_sell_videos : 0); } } } else { $request = array(); $request[] = (!in_array($_POST['video-location'], $_SESSION['uploads']['videos'])); $request[] = (!in_array($_POST['video-thumnail'], $_SESSION['ffempg_uploads'])); $request[] = (!file_exists($_POST['video-location'])); if (in_array(true, $request)) { $error = $lang->error_msg; } } } if (empty($error)) { $file = $duration_file = $getID3->analyze($_POST['video-location']); $duration = '00:00'; if (!empty($file['playtime_string'])) { $duration = PT_Secure($file['playtime_string']); } if (!empty($file['filesize'])) { $filesize = $file['filesize']; } $video_res = (!empty($file['video']['resolution_x'])) ? $file['video']['resolution_x'] : 0; $video_id = PT_GenerateKey(15, 15); $check_for_video = $db->where('video_id', $video_id)->getValue(T_VIDEOS, 'count(*)'); if ($check_for_video > 0) { $video_id = PT_GenerateKey(15, 15); } if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) { $thumbnail = 'upload/photos/thumbnail.jpg'; if (!empty($_FILES['movie_thumbnail']['tmp_name'])) { $file_info = array( 'file' => $_FILES['movie_thumbnail']['tmp_name'], 'size' => $_FILES['movie_thumbnail']['size'], 'name' => $_FILES['movie_thumbnail']['name'], 'type' => $_FILES['movie_thumbnail']['type'] ); $file_upload = PT_ShareFile($file_info); $thumbnail = PT_Secure($file_upload['filename'], 0); // if (!empty($file_upload['filename'])) { // $thumbnail = PT_Secure($file_upload['filename'], 0); // $upload = PT_UploadToS3($thumbnail); // } } } else{ $thumbnail = PT_Secure($_POST['video-thumnail'], 0); if (file_exists($thumbnail)) { $upload = PT_UploadToS3($thumbnail); } } $category_id = 0; $convert = true; $thumbnail = substr($thumbnail, strpos($thumbnail, "upload"), 120); // ****************************** if (PT_IsAdmin() && !empty($_POST['is_movie']) && $_POST['is_movie'] == 1) { $link_regex = '/(http\:\/\/|https\:\/\/|www\.)([^\ ]+)/i'; $i = 0; preg_match_all($link_regex, PT_Secure($_POST['movie_description']), $matches); foreach ($matches[0] as $match) { $match_url = strip_tags($match); $syntax = '[a]' . urlencode($match_url) . '[/a]'; $_POST['movie_description'] = str_replace($match, $syntax, $_POST['movie_description']); } $data_insert = array( 'title' => PT_Secure($_POST['movie_title']), 'category_id' => PT_Secure($_POST['category']), 'stars' => PT_Secure($_POST['stars']), 'producer' => PT_Secure($_POST['producer']), 'country' => PT_Secure($_POST['country']), 'movie_release' => PT_Secure($_POST['release']), 'quality' => PT_Secure($_POST['quality']), 'duration' => $duration, 'description' => PT_Secure($_POST['movie_description']), 'rating' => PT_Secure($_POST['rating']), 'is_movie' => 1, 'video_id' => $video_id, 'converted' => '2', 'size' => $filesize, 'thumbnail' => $thumbnail, 'user_id' => $user->id, 'time' => time(), 'registered' => date('Y') . '/' . intval(date('m')) ); if (!empty($_POST['buy_price']) && is_numeric($_POST['buy_price']) && $_POST['buy_price'] > 0) { $data_insert['sell_video'] = PT_Secure($_POST['buy_price']); } } else{ $link_regex = '/(http\:\/\/|https\:\/\/|www\.)([^\ ]+)/i'; $i = 0; preg_match_all($link_regex, PT_Secure($_POST['description']), $matches); foreach ($matches[0] as $match) { $match_url = strip_tags($match); $syntax = '[a]' . urlencode($match_url) . '[/a]'; $_POST['description'] = str_replace($match, $syntax, $_POST['description']); } if (!empty($_POST['category_id'])) { if (in_array($_POST['category_id'], array_keys(get_object_vars($pt->categories)))) { $category_id = PT_Secure($_POST['category_id']); } } $video_privacy = 0; if (!empty($_POST['privacy'])) { if (in_array($_POST['privacy'], array(0, 1, 2))) { $video_privacy = PT_Secure($_POST['privacy']); } } $age_restriction = 1; if (!empty($_POST['age_restriction'])) { if (in_array($_POST['age_restriction'], array(1, 2))) { $age_restriction = PT_Secure($_POST['age_restriction']); } } $sub_category = 0; if (!empty($_POST['sub_category_id'])) { $is_found = $db->where('type',PT_Secure($_POST['category_id']))->where('lang_key',PT_Secure($_POST['sub_category_id']))->getValue(T_LANGS,'COUNT(*)'); if ($is_found > 0) { $sub_category = PT_Secure($_POST['sub_category_id']); } } $continents_list = array(); if (!empty($_POST['continents-list'])) { foreach ($_POST['continents-list'] as $key => $value) { if (in_array($value, $pt->continents)) { $continents_list[] = $value; } } } $data_insert = array( 'video_id' => $video_id, 'user_id' => $user->id, 'title' => PT_Secure($_POST['title']), 'description' => PT_Secure($_POST['description']), 'tags' => PT_Secure($_POST['tags']), 'duration' => $duration, 'video_location' => '', 'category_id' => $category_id, 'thumbnail' => $thumbnail, 'time' => time(), 'registered' => date('Y') . '/' . intval(date('m')), 'featured' => $featured, 'converted' => '2', 'size' => $filesize, 'privacy' => $video_privacy, 'age_restriction' => $age_restriction, 'sub_category' => $sub_category, 'geo_blocking' => (!empty($continents_list) ? json_encode($continents_list) : '') ); if (!empty($_POST['set_p_v']) && is_numeric($_POST['set_p_v']) && $_POST['set_p_v'] > 0) { $data_insert['sell_video'] = PT_Secure($_POST['set_p_v']); } if ( ($pt->config->approve_videos == 'on' && !PT_IsAdmin()) || ($pt->config->auto_approve_ == 'no' && $pt->config->sell_videos_system == 'on' && !PT_IsAdmin() && !empty($data_insert['sell_video'])) ) { $data_insert['approved'] = 0; } } // ****************************** $insert = $db->insert(T_VIDEOS, $data_insert); if ($insert) { $delete_files = array(); if (!empty($_SESSION['ffempg_uploads'])) { if (is_array($_SESSION['ffempg_uploads'])) { foreach ($_SESSION['ffempg_uploads'] as $key => $file) { if ($thumbnail != $file) { $delete_files[] = $file; unset($_SESSION['ffempg_uploads'][$key]); } } } } if (!empty($delete_files)) { foreach ($delete_files as $key => $file2) { unlink($file2); } } if (isset($_SESSION['ffempg_uploads'])) { unset($_SESSION['ffempg_uploads']); } $data = array( 'status' => 200, 'video_id' => $video_id, 'link' => PT_Link("watch/$video_id") ); ob_end_clean(); header("Content-Encoding: none"); header("Connection: close"); ignore_user_abort(); ob_start(); header('Content-Type: application/json'); echo json_encode($data); $size = ob_get_length(); header("Content-Length: $size"); ob_end_flush(); flush(); session_write_close(); if (is_callable('fastcgi_finish_request')) { fastcgi_finish_request(); } if ($pt->config->queue_count > 0) { $process_queue = $db->getValue(T_QUEUE,'video_id',$pt->config->queue_count); } if ( (count($process_queue) < $pt->config->queue_count && !in_array($video_id, $process_queue)) || $pt->config->queue_count == 0) { if ($pt->config->queue_count > 0) { $db->insert(T_QUEUE, array('video_id' => $insert, 'video_res' => $video_res, 'processing' => 2)); } $ffmpeg_b = $pt->config->ffmpeg_binary_file; $filepath = explode('.', $_POST['video-location'])[0]; $time = time(); $full_dir = str_replace('ajax', '/', __DIR__); $video_output_full_path_240 = $full_dir . $filepath . "_240p_converted.mp4"; $video_output_full_path_360 = $full_dir . $filepath . "_360p_converted.mp4"; $video_output_full_path_480 = $full_dir . $filepath . "_480p_converted.mp4"; $video_output_full_path_720 = $full_dir . $filepath . "_720p_converted.mp4"; $video_output_full_path_1080 = $full_dir . $filepath . "_1080p_converted.mp4"; $video_output_full_path_2048 = $full_dir . $filepath . "_2048p_converted.mp4"; $video_output_full_path_4096 = $full_dir . $filepath . "_4096p_converted.mp4"; $video_file_full_path = $full_dir . $_POST['video-location']; $watermark_image_full_path = "watermark.png"; // demo Video $video_time = ''; $demo_video = ''; if ($pt->config->demo_video == 'on' && !empty($data_insert['sell_video'])) { $have_demo = false; if (!empty($duration_file['playtime_seconds']) && $duration_file['playtime_seconds'] > 0) { $video_time = round((10 * round($duration_file['playtime_seconds'],0)) / 100,0); $video_time = '-t '.$video_time.' -async 1'; $have_demo = true; } } // demo Video $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_240p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'converted' => 1, '240p' => 1, 'video_location' => $filepath . "_240p_converted.mp4" )); if ($pt->config->queue_count > 0) { $db->where('video_id',$insert)->delete(T_QUEUE); } if ($video_res >= 3840) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_4096.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_4096p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '4096p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()). "_video_4096p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=3840:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 2048) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_2048.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_2048p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '2048p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_2048p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=2048:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 1920 || $video_res == 0) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_1080.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_1080p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '1080p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_1080p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1920:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 1280 || $video_res == 0) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_720.' 2>&1'; $shell = shell_exec($ffmpegCommand); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_720p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=1280:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 854 || $video_res == 0) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_480.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_480p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '480p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_480p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=854:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 640 || $video_res == 0) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_360.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_360p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '360p' => 1, )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_360p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=640:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_240p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=426:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video if (file_exists($_POST['video-location'])) { unlink($_POST['video-location']); } pt_push_channel_notifiations($video_id); $_SESSION['uploads'] = array(); } else{ $db->insert(T_QUEUE, array('video_id' => $insert, 'video_res' => $video_res, 'processing' => 0)); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'video_location' => $_POST['video-location'] )); } exit(); } } else { $data = array( 'status' => 400, 'message' => $error_icon . $error ); } } any additional assistance is welcomed
-
Thanks for your message. The only thing I changed was the watermark.png from 98px w by 16px h to a much larger sized image
-
Thanks for your message. I say that because I tested an upload and the watermark was too big for the video
-
Thanks for your reply. I've added a large image, and apparently my current ffmpeg code isn't currently capable of "scaling it down to fit the video dimensions appropriately". I look forward to any guidance on how to ffmpeg code assistance with scaling the image down to fit the video dimensions appropriately
-
I had a similar posting regarding positioning of a 2nd watermark on an uploaded video. I have resoled that successfully - thanks again for the help. Now, the watermarks look clear/sharp on a small screen, but when the screen is enlarged the images don't seem as sharp/clear. What is the trick? Solution? Is it to have a large image to begin with? The watermark.png currently is 98px w by 16px h. Here is a portion of the file code: $watermark_image_full_path = "watermark.png"; // demo Video $video_time = ''; $demo_video = ''; if ($pt->config->demo_video == 'on' && !empty($data_insert['sell_video'])) { $have_demo = false; if (!empty($duration_file['playtime_seconds']) && $duration_file['playtime_seconds'] > 0) { $video_time = round((10 * round($duration_file['playtime_seconds'],0)) / 100,0); $video_time = '-t '.$video_time.' -async 1'; $have_demo = true; } } // demo Video $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_240p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'converted' => 1, '240p' => 1, 'video_location' => $filepath . "_240p_converted.mp4" )); if ($pt->config->queue_count > 0) { $db->where('video_id',$insert)->delete(T_QUEUE); } if ($video_res >= 3840) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_4096.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_4096p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '4096p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()). "_video_4096p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=3840:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 2048) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_2048.' 2>&1'; $shell = shell_exec($ffmpegCommand); $upload_s3 = PT_UploadToS3($filepath . "_2048p_converted.mp4"); $db->where('id', $insert); $db->update(T_VIDEOS, array( '2048p' => 1 )); // demo Video if ($pt->config->demo_video == 'on' && empty($demo_video) && $have_demo == true) { $demo_video = substr($filepath, 0,strpos($filepath, '_video') - 10).sha1(time()) . "_video_2048p_demo.mp4"; $shell = shell_exec("$ffmpeg_b $video_time -y -i $video_file_full_path -vcodec libx264 -preset {$pt->config->convert_speed} -filter:v scale=2048:-2 -crf 26 ".$full_dir . $demo_video." 2>&1"); $upload_s3 = PT_UploadToS3($demo_video); $db->where('id', $insert); $db->update(T_VIDEOS, array( 'demo' => $demo_video )); } // demo Video } if ($video_res >= 1920 || $video_res == 0) { $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "scale=640:-2, scale=640:-2, overlay=10:10, overlay=170:170:enable=between(t\,5\,5+2)" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_1080.' 2>&1'; $shell = shell_exec($ffmpegCommand); any assistance is appreciated
-
Help with adding the watermark again to the video
Chrisj replied to Chrisj's topic in PHP Coding Help
Ok, thanks again for your help. This has succeeded: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.' -filter_complex "overlay=10:10,scale=640:-2, overlay=180:180:enable=between(t\,5\,5+2),scale=640:-2" -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; Yet, on the uploaded test videos, the first watermark in the upper left corner looks small and unsharp, but the 2nd watermark, that displays in the middle after 5 seconds, looks to be the correct size, and sharp. Any ideas on how to improve that will be welcomed. -
Help with adding the watermark again to the video
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks for your reply. Yes, I copied them because I'm trying to add the two same logos with the same code line, as an example showed in the documentation. So, my latest (unsuccessful) attempt is: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.'-i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.'-filter_complex "overlay=10:10,scale=640:-2, overlay=10:10 'if(gte(t,15), -w+(t-2)*20, NAN)',scale=640:-2,"-vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1'; any additional guidance is welcomed -
Help with adding the watermark again to the video
Chrisj replied to Chrisj's topic in PHP Coding Help
If I could find where to edit my previous message here, I would have changed it to say that, upon some more research I see that 10:10 puts the watermark 10 pixels from the top and 10 pixels from the right, correct? So, I added the code above and ran an upload, which appeared to upload, but nothing there when I try to play it. Any additional help is welcomed. -
Help with adding the watermark again to the video
Chrisj replied to Chrisj's topic in PHP Coding Help
Thanks again for your assistance. So, in my current original posted line of code, I don't see any coordinates. However, when it processes it places the logo in the top left corner, which is good. So, based on the linked documentation, I believe I've added a second instance of a logo showing up after 20 seconds. If I'm incorrect please let me know. And any help I can get with adding coordinates to the center for the 2nd logo is appreciated. Here my current modification: $ffmpegCommand =''.$ffmpeg_b.' -y -i '.$video_file_full_path.' -i '.$watermark_image_full_path.' -i '.$watermark_image_full_path.'(t,20) -filter_complex "overlay=10:10,scale=640:-2, overlay=10:10,scale=640:-2," -vcodec libx264 -preset '.$pt->config->convert_speed.' -crf 26 '.$video_output_full_path_240.' 2>&1';