
piyusharora420
Members-
Posts
31 -
Joined
-
Last visited
Everything posted by piyusharora420
-
Creating Thumbnails From Ffmpeg Hangs Php
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Thanks for your instant response. could you please explain how I can do this in background? Please explain with example code if possible.- 3 replies
-
- ffmpegshell_exec
- thumbnail
-
(and 2 more)
Tagged with:
-
Hello, I have been working on a php webservice, which receives videos(uploaded) from iphone and upload them to Amazon cloudFront. After uploading videos, I need to generate thumbnails for video from the Amazon link generated. I am using ffmpeg with shell_exec command for it. Here is the code for the same: public function createThumbnail($userId,$fileUrl,$imageName){ //$imageUrl = 'http://184.168.116.177:81/json_api/json/bin/'; if(!is_dir("images/".$userId)){ mkdir("images/".$userId); } // path of installed ffmpeg $ffmpeg = $_SERVER['DOCUMENT_ROOT'] .'bin/ffmpeg'; $cmd = "$ffmpeg -itsoffset -1 -i $fileUrl -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 images/".$userId."/".$imageName; shell_exec($cmd); return "images/".$userId."/".$imageName; } The above code generates the thumbnail, but script does not execute after shell_exec command. So, there is no response sent to iphone end about the thumbnail link. This function works well video is uploaded from web browser of pc. If I comment, shell_exec command, then response is sent to iphone end, but obviousely image is not created. Thanks in advance.
- 3 replies
-
- ffmpegshell_exec
- thumbnail
-
(and 2 more)
Tagged with:
-
Play Videos In Local Video Player When Clicked On The Link.
piyusharora420 replied to piyusharora420's topic in Other
Could you please explain with an example? Sorry for the late reply -
Hello Everyone, I am doing a project where I am uploading user videos to amazon. On a page, user see titles of all the videos uploaded by him/her. These titles are clickable links(linked to amazon cloud). When clicked, it asks for "Open with" or "Save" in firefox. I want to play video in local player(which is available to user in his local machine) when link is clicked. I hope, it makes sense. Thanks in advance.
-
Convert Bytearray Into Video In Php
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Hi Christian, I can email you the byte array file of a video, if you would like. File size is more than permissible limit. Please let me know your email address. -
Convert Bytearray Into Video In Php
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Hi Kicken, Thanks for your response. I already have tested with file_put_contents, but it does not seem to be working. I tried to convert a byte array file into video, but did not work. That is the file made by Iphone team from a video. I tried to convert it for testing purpose. So, if that file is not convertable, then data in post will not be converted, I think. Is there any difference b/w data in post or data in a file? I could not send you the file because it's size is 1 mb. I can email you if I can get your email id. Awaiting your response. -
Convert Bytearray Into Video In Php
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Hi Christian F. I had a discussion with my friend about it, who is working in .NET technology: Piyush: how do you convert byte array to video? Piyush: what are the steps involved? Shashank Awasthy: use the binary stream to read the byte array and then convert to video in C# Shashank Awasthy: made a file from stream Piyush: while writing to file, do you make any changes in encoding or write it as it is? Shashank Awasthy: i just provide the byte array to stream reader and then convert the stream to file Piyush: Ok Is this helpful in any way? I do not have any experience with it in php and also I have no knowledge of C#. -
Hello Everyone, I am stuck in a task to change byteArray to Video in php. I am creating a webservice in php. This service will receive video in byteArray format from iphone and need to convert it back to original video. I mean, webservice will receive byte array from POST. I could not find any way of converting byteArray into video. byteArray datatype does not seem to be supported by php. Any help would be appreciated.
-
Hello Everyone, I have just started playing with cakephp. I baked one database and implemented registration functionality with validations. I wanted to implement login functionality, but could not achieve it. I have gone through the documentation many times but, no success. Can anyone send me link to the very simple tutorial? I have created login.ctp file in view and login function is defined in controller. I don't know what code should I write in that function and what addition/modifications are needed for model part. Thanks in advance
-
Validate date in cakephp using jquery
piyusharora420 replied to piyusharora420's topic in Frameworks
:'( It is showing 28 days for feb 2012 -
Hi, I have baked one table in cakephp. I have got one date field with three dropdowns for month, day and year respectively.I want to change number of days as per the month and year dropdown in real time. I have worked in same situation in case of core php. But, could not understand how this can be achieved in cakephp. Thanks in advance
-
Not able to understand cakephp code format
piyusharora420 replied to piyusharora420's topic in Frameworks
But, I could not understand the benefits of using objects inside objects. Could you please provide me a link where I can see any example? I have gone through the below link: http://www.tuxradar.com/practicalphp/6/6/0 But, it does not explain any benefit. -
Not able to understand cakephp code format
piyusharora420 replied to piyusharora420's topic in Frameworks
Hi Thorpe, Thanks for the response. I think, I have got it. -
Not able to understand cakephp code format
piyusharora420 replied to piyusharora420's topic in Frameworks
Hi, Thanks for the prompt reply. I am afraid, I am still unable to understand it completely. I could not understand "input" in $this->Form->input -
Hello Everyone, I have just started working on cakephp framework. I have seen methods like $this->Form->input. I have not worked ever with such things. I can understand $this->variableName or $this->methodName. But what is meaning of "Form" there? Is this calling object of a class in other class? Thanks in advance
-
Hi, I am using facebook js sdk for login at my test site. I am getting blank page where I should get the permissions page. After refreshing the page it logged in. Means, after filling in the details I get a blank page, but actually it logged into facebook. Please go through the below link for self explanatory video. http://screencast.com/t/xpJ4FOgg And, let me know which files do I need to send. Thanks in advance.
-
Hello Everyone, I want to use jquery for validating forms. I have written the below mentioned code for the same. But, else part of each function is automatically called without any blur or keyup event. $(document).ready(function(){ var reg=$("#reg"); var firstName=$("#firstName"); var lastName=$("#lastName"); var email=$("#email"); var reEmail=$("#reEmail"); var password=$("#password"); var gender=$('#gender'); var month=$("#month"); var year=$("#year"); var day=$("#day"); firstName.blur(isValidName($(this),"First name can contatin only alphabets","#firstNameValidate")); lastName.blur(isValidName($(this),"last name can contatin only alphabets","#lastNameValidate")); email.blur(isValidEmail(email,"Enter a valid email address","#emailValidate")); reEmail.blur(isValidEmail($(this),"Enter a valid email address","#reEmailValidate")); password.blur(isValidPassword($(this),"Password length should be b/w 8 and 15","#passwordValidate")); gender.blur(isNull($(this),"Please select your gender","#genderValidate")); firstName.keyup(isValidName($(this),"First name can contatin only alphabets","#firstNameValidate")); lastName.keyup(isValidName($(this),"First name can contatin only alphabets","#firstNameValidate")); email.keyup(isValidEmail($(this),"Enter a valid email address","#emailValidate")); reEmail.keyup(isValidEmail($(this),"Enter a valid email address","#reEmailValidate")); password.keyup(isValidPassword($(this),"Password length should be b/w 8 and 15","#passwordValidate")); gender.keyup(isNull($(this),"Please select your gender","#genderValidate")); reg.submit(function(){ if(isValidName() & isValidateEmail() & isValidPassword() & isNull()) return true else return false; }); function isValidName(name,alertMsg,id) { var a=name.val(); var nameRegex=/^[a-zA-Z]+$/; if(nameRegex.test(a)) { $(id).removeClass("yellow").addClass("form.reg td span").text("whats your first name?"); return true; } else { $(id).addClass("yellow").removeClass("form.reg td span").text(alertMsg); name.focus(); return false; } } //Function for validating Email address function isValidEmail(elem, helperMsg,id) { var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(elem.val().match(emailExp)) { $(id).removeClass("yellow").addClass("form.reg td span"); return true; } else { //alert(helperMsg); $(id).addClass("yellow").removeClass("form.reg td span").text(helperMsg); elem.focus(); return false; } } //Function for validating passwords function isValidPassword(password,alertMsg,id) { var passRegex=/^[\w\-\@\#\&\*\%\$]{8,15}$/; if(password.val().match(passRegex)) { $(id).removeClass("yellow").addClass("form.reg td span"); return true; } else { $(id).addClass("yellow").text("whats your password"); //alert(alertMsg); password.focus(); return false; } } //Function for checking emply values function isNull(anyValue,alertMsg,id) { if(anyValue.val().length!=0) { $(id).removeClass("yellow").addClass("form.reg td span"); return true; } else { //alert(alertMsg); $(id).addClass("yellow").text(alertMsg); anyValue.focus(); return false; } } });
-
Form is submitted even after returning false
piyusharora420 replied to piyusharora420's topic in Javascript Help
You are correct. It worked. Thanks alot -
Hi, I have done some validations using javascript. It is working but form is still submitted even it returns false. I have used onclick="return function()" in html file. function isValidName(name,nameRegex) { if(!(name.match(nameRegex))) { alert("name can contains only alphabets"); //name.focus(); return false; } } //email format should match with the emailRegex function isValidEmail(email,emailRegex) { if(!email.match(emailRegex)) { alert("invalid email address"); //email.focus(); return false; } } //Password Length should be b/w 8 and 15 function isValidPassword(password,passRegex) { if(!password.match(passRegex)) { alert("Invalid password"); //password.focus(); return false; } } function checkInput() { // Stored values in variables var firstName=document.getElementById("firstName").value; var lastName=document.getElementById("lastName").value; var email=document.getElementById("email").value.toLowerCase(); var reEmail=document.getElementById("reEmail").value.toLowerCase(); var password=document.getElementById("password").value; var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; var nameRegex=/^[a-zA-Z]+$/; var passRegex=/^[\w\-\@\#\&\*\%\$]{8,15}$/; isValidName(firstName,nameRegex); isValidName(lastName,nameRegex); isValidPassword(password,passRegex); isValidEmail(email,emailRegex); isValidEmail(reEmail,emailRegex); if(document.getElementById('gender').value=="") { alert("please select your gender"); document.getElementById('gender').focus(); return false; } return true; } Thanks in advance
-
Blank password should not be updated
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Here is tha JavaScript code: // JavaScript Document function check_input() { // Stored values in variables var f_name=document.getElementById("f_name").value; var l_name=document.getElementById("l_name").value; var email=document.getElementById("email").value.toLowerCase(); var remail=document.getElementById("re-email").value.toLowerCase(); var password=document.getElementById("password").value; var l_name=document.getElementById("l_name").value; var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; var nameRegex=/^[a-zA-Z]+$/; if(!(f_name.match(nameRegex))) { alert("First name can contains only alphabets"); document.getElementById('f_name').focus(); return false; } if(!(l_name.match(nameRegex))) { alert("last name can contain only alphabets"); document.getElementById('l_name').focus(); return false; } //email format should match with the emailRegex if(!email.match(emailRegex)) { alert("invalid email address"); document.getElementById('email').focus(); return false; } if(!remail.match(emailRegex)) { alert("invalid email address"); document.getElementById('re-email').focus(); return false; } if(email!=remail) { alert("emails do not match"); return false; } //Password Length should be b/w 8 and 15 if(password.length<=8 || password.length>=15) { alert("password length should be b/w 8 and 15"); document.getElementById('password').focus(); return false; } if(document.getElementById('gender').value=="") { alert("please select your gender"); document.getElementById('gender').focus(); return false; } return true; } function showHint(str) { var xmlhttp; if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } //Request opened xmlhttp.open("GET","reg_ajax.php?q="+str,true); //Request sent xmlhttp.send(); } function check_input_login() { var email=document.login.email.value; var password=document.login.password.value; var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(!(email.match(emailRegex))) { alert("Invalid Email Address"); document.login.email.focus(); return false; } if(password.length<=8 || password.length>=15) { alert("password length should be b/w 8 and 15"); document.login.password.focus(); return false; } return true; } function update() { var f_name=document.getElementById("f_name").value; var l_name=document.getElementById("l_name").value; var email=document.getElementById("email").value.toLowerCase(); var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; var nameRegex=/^[a-zA-Z]+$/; if(!(f_name.match(nameRegex))) { alert("First name can contains only alphabets"); document.getElementById('f_name').focus(); return false; } if(!(l_name.match(nameRegex))) { alert("last name can contain only alphabets"); document.getElementById('l_name').focus(); return false; } //email format should match with the emailRegex if(!email.match(emailRegex)) { alert("invalid email address"); document.getElementById('email').focus(); return false; } return true; } -
Blank password should not be updated
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Sure, <?php session_start(); include_once "includes/db.php"; include_once "includes/functions.php"; $err=""; //Check if session exists if(isset($_SESSION['email'])) { $db=new DB(); $result=$db->selectFetch("reg_form","Email='".$_SESSION['email']."'"); //Checking if form is submitted if(isset($_POST['Submit'])) { //assign values to variables if form is submitted $f_name=trim($_POST['f_name']); $l_name=trim($_POST['l_name']); $email=trim($_POST['email']); $password=trim(base64_encode($_POST['password'])); $tools=new validations(); $err=$tools->validateFirstName($f_name); $err.=$tools->validateLastName($l_name); $err.=$tools->validateEmail($email); if($err=="") { $update=$db->update($_SESSION['email'],$email,$password,$f_name,$l_name); if($update==true) { header('location:profileUpdated.php'); }} else { echo $err; } } } else { header('location:login.php'); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><script type="text/javascript" src="js/validationsAjax.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form method="post" enctype="multipart/form-data" name="reg" id="reg" ><table border="1" > <tr><td>First Name:</td><td><input type="text" name="f_name" id="f_name" value="<?php echo $result->f_name; ?>"></td></tr> <tr><td>Last Name</td><td><input type="text" name="l_name" id="l_name" value="<?php echo $result->l_name; ?>"></td></tr> <tr><td>Your Email</td><td><input type="text" name="email" id="email" onBlur="showHint(this.value)" onkeyup="showHint(this.value)" onKeyDown="showHint(this.value)" value="<?php echo $result->Email; ?>"></td><td style="border:0px"><span id="txtHint" ></span></td></tr> <tr><td><input type="file" name="image" /></td></tr> <tr><td>Password:</td><td><input type="password" name="password" id="password"></td></tr> <input type="submit" name="Submit" value="Update" onClick="return update()"> </table></form> </body> </html> -
Blank password should not be updated
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Also, javascript is not working for this page. Please have a look on the below js file: // JavaScript Document function check_input() { // Stored values in variables var f_name=document.getElementById("f_name").value; var l_name=document.getElementById("l_name").value; var email=document.getElementById("email").value.toLowerCase(); var remail=document.getElementById("re-email").value.toLowerCase(); var password=document.getElementById("password").value; var l_name=document.getElementById("l_name").value; var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; var nameRegex=/^[a-zA-Z]+$/; if(!(f_name.match(nameRegex))) { alert("First name can contains only alphabets"); document.getElementById('f_name').focus(); return false; } if(!(l_name.match(nameRegex))) { alert("last name can contain only alphabets"); document.getElementById('l_name').focus(); return false; } //email format should match with the emailRegex if(!email.match(emailRegex)) { alert("invalid email address"); document.getElementById('email').focus(); return false; } if(!remail.match(emailRegex)) { alert("invalid email address"); document.getElementById('re-email').focus(); return false; } if(email!=remail) { alert("emails do not match"); return false; } //Password Length should be b/w 8 and 15 if(password.length<=8 || password.length>=15) { alert("password length should be b/w 8 and 15"); document.getElementById('password').focus(); return false; } if(document.getElementById('gender').value=="") { alert("please select your gender"); document.getElementById('gender').focus(); return false; } return true; } function showHint(str) { var xmlhttp; if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } //Request opened xmlhttp.open("GET","reg_ajax.php?q="+str,true); //Request sent xmlhttp.send(); } function check_input_login() { var email=document.login.email.value; var password=document.login.password.value; var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; if(!(email.match(emailRegex))) { alert("Invalid Email Address"); document.login.email.focus(); return false; } if(password.length<=8 || password.length>=15) { alert("password length should be b/w 8 and 15"); document.login.password.focus(); return false; } return true; } function update() { var f_name=document.getElementById("f_name").value; var l_name=document.getElementById("l_name").value; var email=document.getElementById("email").value.toLowerCase(); var emailRegex=/^[a-zA-Z\_][\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; var nameRegex=/^[a-zA-Z]+$/; if(!(f_name.match(nameRegex))) { alert("First name can contains only alphabets"); document.getElementById('f_name').focus(); return false; } if(!(l_name.match(nameRegex))) { alert("last name can contain only alphabets"); document.getElementById('l_name').focus(); return false; } //email format should match with the emailRegex if(!email.match(emailRegex)) { alert("invalid email address"); document.getElementById('email').focus(); return false; } return true; } -
Blank password should not be updated
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Sure, here is the code: <?php session_start(); include_once "includes/db.php"; include_once "includes/functions.php"; $err=""; //Check if session exists if(isset($_SESSION['email'])) { $db=new DB(); $result=$db->selectFetch("reg_form","Email='".$_SESSION['email']."'"); //Checking if form is submitted if(isset($_POST['Submit'])) { //assign values to variables if form is submitted $f_name=trim($_POST['f_name']); $l_name=trim($_POST['l_name']); $email=trim($_POST['email']); $password=trim(base64_encode($_POST['password'])); $tools=new validations(); $err=$tools->validateFirstName($f_name); $err.=$tools->validateLastName($l_name); $err.=$tools->validateEmail($email); if($err=="") { $update=$db->update($_SESSION['email'],$email,$password,$f_name,$l_name); if($update==true) { header('location:profileUpdated.php'); }} else { echo $err; } } } else { header('location:login.php'); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><script type="text/javascript" src="js/validationsAjax.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form method="post" enctype="multipart/form-data" name="reg" id="reg" ><table border="1" > <tr><td>First Name:</td><td><input type="text" name="f_name" id="f_name" value="<?php echo $result->f_name; ?>"></td></tr> <tr><td>Last Name</td><td><input type="text" name="l_name" id="l_name" value="<?php echo $result->l_name; ?>"></td></tr> <tr><td>Your Email</td><td><input type="text" name="email" id="email" onBlur="showHint(this.value)" onkeyup="showHint(this.value)" onKeyDown="showHint(this.value)" value="<?php echo $result->Email; ?>"></td><td style="border:0px"><span id="txtHint" ></span></td></tr> <tr><td><input type="file" name="image" /></td></tr> <tr><td>Password:</td><td><input type="password" name="password" id="password"></td></tr> <input type="submit" name="Submit" value="Update" onClick="return update()"> </table></form> </body> </html> -
Hello Everyone, I have created simple reg/login forms. I also provided option to user for updating his/her profile. When a user navigate to updation page, they get prefilled fields. But, password is not pre filled for security reasons. So, if a user update his profile without worrying about password, then password should not be updated. In my case, password blanked out in database. Thanks in advance.
-
add an element to array without using build in function
piyusharora420 replied to piyusharora420's topic in PHP Coding Help
Thanks alot pbs.