PHP - Audio Files Controls Not Working On Android And Iphones
I have php code that uses mp3 audio files stored in a database for the user to listen to. The page loads and the audio controls work and the files play on a desktop and laptop just fine. When trying to play a file on an android or IPhone, when you press the play (or any other control) nothing happens. It acts like the page is static. There is a home button on the webpage and it works so I know the page is interactive. Below is the code. I would appreciate any help. Thank you.
<?php Similar TutorialsHi, I have limited experience of using PHP, but having done some searching around it would seem that it is possible to convert audio files that are uploaded through a web page to mp3 using ffmpeg. The audio files would be uploaded using the Uploadify script to subfolders that are named according to the user's login. I would need the PHP script to be able to process all audio files that are either not in MP3 format, or are in MP3 format but greater than 192kbps, deleting the original file after the conversion. Am I right in thinking that this could be achieved using PHP, and if so, can anyone get me started with some code, or a link to a webpage with some code? Also, I am currently using Hostpapa for hosting my website, and I understand that they don't include ffmpeg, and also don't allow ssh. I read on one website that I could still install a compiled version of ffmpeg on a shared server, but I am not sure if this means that it would work on Hostpapa, or whether I would need to change my host to get ffmpeg working. Any advice on any of this would be welcome! Thanks, Nick I have a Joomla website having one folder for audio files in it and their links are saved in database. Now I want to show two calendars to the user at front end, so that they can choose that from when to from he want to download the audio files? for e.g he can select june-2-2014 in one calendar and august-2-2014 in second calendar, now on clicking download button the files residing between the two specific dates must get archived into one zip file and then start downloading... i have a reference link for creating a zip and downloading the zip :http://coursesweb.ne...-archive-php_cs now i am stuck that how to get the selection of user from calendar , save it into the array , and from the array get the files from the folder matching the array indexes and then zip , download them. please tell me how to achieve this task ? Hello there, I have a problem with a form, as soon as I fill the for using a query. The buttons doesn't work anymore. They work when i open the page, they have somoe js to emable and diable controls. but when i do a search and get the form filled, non of the controls work anymore. Any advise? IS there any special code for doing this? Im not familiar with this kind of optimising
Hi.I found out that PHP developers can make apps for android too with zend which I'm really interested in.Does anyone have any resource or tutorial teaching how to do that?for now the apps I'm going to develop are just going to contain Text.not advanced apps do crazy things.
BTW I'm new to php and trying to learn fudamentals etc.If I want to go into app development wouldn't it confuse me?can I do that?thanks and sorry for my english
Hi all, I've got two scripts for my website which I would like to display on one page, but what i've got is, The Menu on one php file, and the content on a different php file. Ive tryed the include, include_once, require, require_once, but for which ever one I use it just displace a blank page with nothing on it. Both of the files work on there on, but when I include the menu to the content page it just dont show anything. This is what ive tryed: <?php include ("crewtop.php"); if ($crewstuff->boss == $username || $crewstuff->coowner == $username || $crewstuff->underboss == $username){ ?> <table width='80%' align='center' class='table' cellpadding='0' cellspacing='0' border='1'> <tr> <td class='header' colspan='4' align='center'>Current Crew Members</td> </tr> <tr> <td class='omg' align='center' width='25%'>Username</td><td class='omg' align='center' width='25%'>Rep</td><td class='omg' align='center' width='25%'>Rank</td><td class='omg' width='25%' align='center'>Kick</td> </tr> This seems a easy thing to sort, just I carnt see why it isnt displaying the other file.. Anyone see why? Thanks. (if more code is needed i'll display more) Good morning! I was wondering how can i access the php data to the health data (steps, heart rate etc ..) of devices with android and ios? I don't know maybe by inserting the keys I can access the json with the related data... I tried to search a bit on the internet but I see that I can only do it if I create an app for both systems and then from there I enter the data in my mysql database.. I don't know where to start, do you know something? Thank you I want to build a online "app builder" project that users can create android / iphone applications online without any coding knowledge. These sites are very common in market. They offer onclick app builder. I have skill in development of web applications using php frameworks. My question is How we can generate android apk from our server after getting the necessary information from user? (Appname, icon, packagename etc) PHP can do this entire task?, if yes any framework for that? Can you give me some basic tips to generate apk from our server? Can we genrate both android and iphone app from one single code? What are the requirements needed for the server? Anybody having skills in these areas, please help me. I need basic tips to get started this project. Thanks Hey guys, I have an image upload script and it's working fine. But for some files it will not work. It says it can't get the filesize and it can't copy that file. I have tried to change the file format of that file, but with no result. So it's not the file format. Is there anything else that could confuse getfilesize and copy commands in PHP? Can you please tell me what is wrong? include ("include/session.php"); //Pohranjivanje podataka za 1. sliku $naziv1 = mysql_real_escape_string($_POST["naziv1"],$veza); $opis1 = mysql_real_escape_string($_POST["opis1"],$veza); $album_id = mysql_real_escape_string($_POST["album_id"],$veza); $datum1 = date("Y-m-d H:i:s"); //Upload slike i thumba //define a maxim size for the uploaded images define ("MAX_SIZE","10000000000"); // define the width and height for the thumbnail // note that theese dimmensions are considered the maximum dimmension and are not fixed, // because we have to keep the image ratio intact or it will be deformed define ("WIDTH","200"); define ("HEIGHT","150"); // this is the function that will create the thumbnail image from the uploaded image // the resize will be done considering the width and height defined, but without deforming the image function make_thumb($img_name,$filename,$new_w,$new_h) { //get image extension. $ext=getExtension($img_name); //creates the new image using the appropriate function from gd library if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); if(!strcmp("gif",$ext)) $src_img=imagecreatefromgif($img_name); //gets the dimmensions of the image $old_x=imageSX($src_img); $old_y=imageSY($src_img); // next we will calculate the new dimmensions for the thumbnail image // the next steps will be taken: // 1. calculate the ratio by dividing the old dimmensions with the new ones // 2. if the ratio for the width is higher, the width will remain the one define in WIDTH variable // and the height will be calculated so the image ratio will not change // 3. otherwise we will use the height ratio for the image // as a result, only one of the dimmensions will be from the fixed ones $ratio1=$old_x/$new_w; $ratio2=$old_y/$new_h; if($ratio1>$ratio2) { $thumb_w=$new_w; $thumb_h=$old_y/$ratio1; } else { $thumb_h=$new_h; $thumb_w=$old_x/$ratio2; } // we create a new image with the new dimmensions $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // resize the big image to the new created one imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // output the created image to the file. Now we will have the thumbnail into the file named by $filename if(!strcmp("png",$ext)) imagepng($dst_img,$filename); else imagejpeg($dst_img,$filename); //destroys source and destination images. imagedestroy($dst_img); imagedestroy($src_img); } // This function reads the extension of the file. // It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } // This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. If the error occures the file will not be uploaded. $errors=0; // checks if the form has been submitted if(isset($_POST['spremi'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['slika1']['name']; // if it is not empty if ($image) { // get the original name of the file from the clients machine $filename = stripslashes($_FILES['slika1']['name']); // get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); // if it is not a known extension, we will suppose it is an error, print an error message //and will not upload the file, otherwise we continue if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { // get the size of the image in bytes // $_FILES[\'image\'][\'tmp_name\'] is the temporary filename of the file in which the uploaded file was stored on the server $size=getimagesize($_FILES['slika1']['tmp_name']); $sizekb=filesize($_FILES['slika1']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($sizekb > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name1=mt_rand(0,9999999).'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="slike_natjecanja/".$image_name1; $copied = copy($_FILES['slika1']['tmp_name'], $newname); //we verify if the image has been uploaded, and print error instead if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } else { // the new thumbnail image will be placed in images/thumbs/ folder $thumb_name='slike_natjecanja/thumbs/thumb_'.$image_name1; $thumb_name1 = 'thumb_'.$image_name1; // call the function that will create the thumbnail. The function will get as parameters //the image name, the thumbnail name and the width and height desired for the thumbnail $thumb=make_thumb($newname,$thumb_name,WIDTH,HEIGHT); }} }} //If no errors registred, print the success message and show the thumbnail image created if(isset($_POST['Submit']) && !$errors) { echo "<h1>Thumbnail created Successfully!</h1>"; echo '<img src="'.$thumb_name.'">'; } if (empty($_FILES['slika1']['name'])) { echo "Prazno je!"; die; } else { //Ubacivanje u bazu $upit = "INSERT INTO natjecanja_slike_sve (album_id, naziv_slike, opis_slike, datum_dodavanja_slike, slika_nat_mala, slika_nat_velika) VALUES ('$album_id', '$naziv1', '$opis1', '$datum1', '$thumb_name1', '$image_name1')"; echo "$upit"; die; $rezultat = mysql_query($upit) or die (mysql_error()); } Hi i have the script to upload files i set the type of file and extension allowed all the files type and extension i can upload except mp4 is ther anything extra i need to do isnt file type (video/mp4) extension (mp4) but still not working. Code: [Select] <?php mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("database_name") or die(mysql_error()) ; // my file the name of the input area on the form type is the extension of the file //echo $_FILES["myfile"]["type"]; //myfile is the name of the input area on the form $name = $_FILES["image"]["name"]; // name of the file $type = $_FILES["image"]["type"]; //type of the file $size = $_FILES["image"]["size"]; //the size of the file $temp = $_FILES["image"]["tmp_name"];//temporary file location when click upload it temporary stores on the computer and gives it a temporary name $error =array(); // this an empty array where you can then call on all of the error messages $allowed_exts = array('jpg', 'jpeg', 'png', 'gif','avi','mp4'); // array with the following extension name values $image_type = array('image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'video/mp4'); // array with the following image type values $location = 'images/'; //location of the file or directory where the file will be stored $appendic_name = "news".$name;//this append the word [news] before the name so the image would be news[nameofimage].gif // substr counts the number of carachters and then you the specify how how many you letters you want to cut off from the beginning of the word example drivers.jpg it would cut off dri, and would display vers.jpg //echo $extension = substr($name, 3); //using both substr and strpos, strpos it will delete anything before the dot in this case it finds the dot on the $name file deletes and + 1 says read after the last letter you delete because you want to display the letters after the dot. if remove the +1 it will display .gif which what we want is just gif $extension = strtolower(substr($name, strpos ($name, '.') +1));//strlower turn the extension non capital in case extension is capital example JPG will strtolower will make jpg // another way of doing is with explode // $image_ext strtolower(end(explode('.',$name))); will explode from where you want in this case from the dot adn end will display from the end after the explode $title = $_POST["title"]; $subtitle = $_POST["subtitle"]; if (isset($image)) // if you choose a file name do the if bellow { // if extension is not equal to any of the variables in the array $allowed_exts error appears if(in_array($extension, $allowed_exts) === false ) { $error[] = 'Extension not allowed! gif, jpg, jpeg, png only<br />'; // if no errror read next if line } // if file type is not equal to any of the variables in array $image_type error appears if(in_array($type, $image_type) === false) { $error[] = 'Type of file not allowed! only images allowed<br />'; } // check if folder exist in the server if(!file_exists ($location)) { $error[] = 'No directory ' . $location. ' on the server Please create a folder ' .$location; } } // if no error found do the move upload function if (empty($error)){ if (move_uploaded_file($temp, $location .$appendic_name)) { if (move_uploaded_file($temp1, $location .$name1)) { // insert data into database first are the field name teh values are the variables you want to insert into those fields appendic is the new name of the image mysql_query("INSERT INTO tablename (title, subtitle, image) VALUES ('$title', '$subtitle', '$appendic_name')") ; echo $type; echo "<br />"; echo $type1; } } else { foreach ($error as $error) { echo $error; } } } //echo $type; ?> I inherrited a site that has PHP code that decides to either serve the dedicated mobile site or desktop site to the user. I would prefer that tablets get served the mobile site. Currently Android tablet users get served the desktop site. I'd like to figure out how I can implement User Agent to detect an android tablet (with distinction from an Android phone) This is the code I'm working with to determine which site to serve (mobile or desktop) Thanks if ((strpos($user_agent, 'Mobile') === false && // Generic mobile browser string, most browsers have it. strpos($user_agent, 'SymbianOS') === false && // Nokia device running Symbian OS. strpos($user_agent, 'Opera M') === false && // Opera Mini or Opera Mobile. strpos($user_agent, 'Android') === false && // Android devices that don't have 'Mobile' in UA string. stripos($user_agent, 'HTC_') === false && // HTC devices that don't have 'Mobile' nor 'Android' in UA string. Case insensitive. strpos($user_agent, 'Fennec/') === false && // Firefox mobile strpos($user_agent, 'Kindle') === false && // Kindle Fire tablet strpos($user_agent, 'BlackBerry') === false) || // BlackBerry strpos($user_agent, 'iPad') === false) // iPad { // Serve Desktop Site return false; } As mention in my title, I am using wordpress, bought a theme and the support team is not able to assist me without the FTP access.
URL: http://www.icv.solutions/swagger
Mobile: Android 4.4.2
Chrome: version 39.0.2171.93
Safari: star safari version 1.1
I am not able to scroll only on the above browser, other browser like firefox and default internet explorer on mobile have no such issue.
In fact the older version of chrome have no such issue too,
If anyone could give me a hint where might the problem lies at or any help at all, would be great.
I have been struggling with this for awhile now.
Thanks and happy holiday!
I have a little php site that looks up data in my crm database quickly and easily on my iphone. Right now it's wide open because I'm in and out of it all day and trying to input uid/pw into a secure login page is a pain in the rear. (we're not talking about sensitive data here and I'm the only user.) So, I would like to design a screen with several large graphic buttons and be able to touch those buttons in a specific sequence that would functionally allow a secure login. Similar in concept to the android screen lock. You touch a sequence of numbered buttons and voila, the screen unlocks. It does not open a text field for data entry into two separate fields. So if my access code was 1,2,3,4 and the screen was divided into quarters with a large number on each one, I would touch the buttons in that order and it would open the main page. How would this best be accomplished? Is there a php function to essentially build a variable through successive key presses? then with a final submit it would just check that against a "secret code" and allow access. Thanks for any input. Hello friends; Is there a controls for php like asp (Grid-dropbox - listbox) and so on and what is best editor for php Thank you so much I have Wordpress based site where i've included a class for the main menu that produces a hover and shadow effect. Problem is it breaks the menu in the fully responsive mode when the display adjusts for the viewing dimensions. So I need to remove that class from the menu for anything related to the @media controls.
The site is viewable he http://ailimconsulting.com
If you view it full screen then you'll see the hover effect. Shrink it down and you'll see the menu collapses (it's designed to) but when you use the menu the shadow/hover effect is still present and 'breaks' the menu (loooks like jumbled crap). We just want to remove the hover effect for viewing on mobile devices.
I'm not sure if there's a CSS way to 'remove' a class. This may have to be done with jQuery. I'm looking for options and if anyone knows how I would either remove or counteract the float-shadow class.
Thanks.
Hi everyone. I am David and I am new to web design and php. I am following a Lynda.com tutorial on php and sql. I have reached a certain point in the tutorial where I am reading values back from my database in to a php variable. The variable is holding an array data type and I am accessing the element within the array. I want a HTML select control and 2 radios buttons to reflect the values in the database. Therefore the Select control should read a numeric value of type int and the radio buttons are reflecting either a 1 or a 0. Firstly the code for the Select control uses a for loop to count the array elements and load the count into the Select control. The example uses php mixed with html. The for loop will count the number of element and add a number to the select control. The an If statment is used to make a decision if the count variable equals the value in the array element $sel_subject['position'] then select that value. This does not happen, and I can not seem to get it to work. <p>Position: <select name="position"> <!--use a php block so as to use some php variables --> <!--Use these variables with the get_all_sublects function. --> <!-- This function will return all the dataset --> <?php $sel_subject = get_all_subjects(); //Then use the mysql fuction to retuen the numberic value of all the rows. $subject_count = mysql_num_rows($sel_subject); //$subject_count + 1 becauce we are adding a subject for($count=1; $count <= $subject_count+1; $count++) { echo "<option value=\"{$count}\""; if ($sel_subject['position'] == $count) { echo " selected"; } echo ">{$count}</option>"; } ?> </select> </p> Secondly the radio buttons do something similar in that i want them to reflect the value in the array element. If a 1 then True and so be checked or 0 and so false and so be unchecked. <p>Visible: <input type= "radio" name= "visible" value= "0" <?php if ($sel_subject['visible'] == 0) { echo 'checked=" checked"'; } ?> >No</input> <input type= "radio" name= "visible" value= "1" <?php if ($sel_subject['visible'] == 1) { echo 'checked=" checked"'; } ?> >Yes</input> </p> Again this doesn't work either. So in summary, I cant get the php code to affect the html form controls and relay the stored data to the user. I have been racking my brain for days and getting no where. Please can anyone help me with this. I would be very grateful. All the best Irish_Dave So far I have managed to create an upload process which uploads a picture, updates the database on file location and then tries to upload the db a 2nd time to update the Thumbnails file location (i tried updating the thumbnails location in one go and for some reason this causes failure) But the main problem is that it doesn't upload some files Here is my upload.php <?php include 'dbconnect.php'; $statusMsg = ''; $Title = $conn -> real_escape_string($_POST['Title']) ; $BodyText = $conn -> real_escape_string($_POST['ThreadBody']) ; // File upload path $targetDir = "upload/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $Thumbnail = "upload/Thumbnails/'$fileName'"; if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){ // Allow certain file formats $allowTypes = array('jpg','png','jpeg','gif','pdf', "webm", "mp4"); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; $targetFilePathArg = escapeshellarg($targetFilePath); $output=null; $retval=null; //exec("convert $targetFilePathArg -resize 300x200 ./upload/Thumbnails/'$fileName'", $output, $retval); exec("convert $targetFilePathArg -resize 200x200 $Thumbnail", $output, $retval); echo "REturned with status $retval and output:\n" ; if ($retval == null) { echo "Retval is null\n" ; echo "Thumbnail equals $Thumbnail\n" ; } }else{ $statusMsg = "File upload failed, please try again."; } }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, mp4, webm & PDF files are allowed to upload.'; } }else{ $statusMsg = 'Please select a file to upload.'; } //Update SQL db by setting the thumbnail column to equal $Thumbnail $update = $conn->query("update Threads set thumbnail = '$Thumbnail' where filename = '$fileName'"); if($update){ $statusMsg = "Updated the thumbnail to sql correctly."; echo $statusMsg ; } else { echo "\n Failed to update Thumbnail. Thumbnail equals $Thumbnail" ; } // Display status message echo $statusMsg; ?> And this does work on most files however it is not working on a 9.9mb png file which is named "test.png" I tested on another 3.3 mb gif file and that failed too? For some reason it returns the following Updated the thumbnail to sql correctly.Updated the thumbnail to sql correctly. Whereas on the files it works on it returns REturned with status 0 and output: Retval is null Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif' Failed to update Thumbnail. Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif'The file rainbow-trh-stache.gif has been uploaded successfully. Any idea on why this is? Hello I have a simple question about file handling... Is it possible to list all files in directories / subdirectories, and then read ALL files in those dirs, and put the content of their file into an array? Like this: array: [SomePath/test.php] = "All In this php file is being read by a new smart function!"; [SomePath/Weird/hello.txt = "Hello world. This is me and im just trying to get some help!";and so on, until no further files exists in that rootdir. All my attempts went totally crazy and none of them works... therefore i need to ask you for help. Do you have any ideas how to do this? If so, how can I be able to do it? Thanks in Advance, pros I know this can't be accomplished with JUST PHP, however a few questions. I want to create code that will allow users to record an audio message and then this will be saved as a file and linked into my database (hence the PHP/MySQL requirement). How would I go about this? Is it possible? Which languages would I need? hey back again, I need help finding something like the audio player found at www.soundowl.com. I need it to be similar in the sense that the URL of the file cannot be found in the source code and this is exactly what I need for my website, any help will be appreciated, thank you in advance |