Jump to content

deansatch

Members
  • Posts

    300
  • Joined

  • Last visited

Everything posted by deansatch

  1. Just a short script on test.php running in the browser
  2. Indeed! I didn't get any error message from php but the end of my output array said: "time=00:03:55.53 bitrate=1475.5kbits/s" [162]=> string(82) "video:38131kB audio:4081kB subtitle:0 global headers:7kB muxing overhead 0.481304%" }" If that makes any sense to anyone cool I am planning on using a quad core 2.5ghz, 8gb ram machine. Any good? I thought it might be more of a linuxy type of problem. I will have another go and set my max execution and memory limit higher (any suggestions to accommodate a maximum 50MB / 5 minute file converted as mentioned in OP?)
  3. I am trying to write a script so that almost any video file (those supported by ffmpeg) that is uploaded is automatically: a) resized to a maximum width of 480px b ) converted to a .mv4 file c) a second version is created as a .ogv file d) a screenshot is taken to use as a video placeholder image. This is what I came up with and it worked fine when I converted a small .mov and .mp4 file: exec('/opt/local/bin/ffmpeg -i testvids/test.m4v -strict -2 -ar 22050 -vf scale=480:ih*480/iw testvids/done.m4v 2>&1', $output, $result); exec('/opt/local/bin/ffmpeg -i testvids/test.m4v -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 testvids/done.ogv 2>&1', $output, $result); exec('/opt/local/bin/ffmpeg -itsoffset -4 -i testvids/test.m4v -vcodec mjpeg -vframes 1 -an -f rawvideo -vf "scale=480:-1" testvids/images/done.png', $output, $result); When I tested it on a 50MB .m4v file it failed and created corrupt files instead. Is there something I need to know about converting from different formats? And as a side note, how much trouble would this be for my dedicated server if it was done fairly regularly? Thanks EDIT: I am doing this in PHP but perhaps this isn't really a PHP question?
  4. Build a calendar with clickable events, instead of a simple list of events?!?
  5. I have this code which I use to list some events. But I have to make the list into a calendar instead now and still have the event dates clickable. I have been on for bloody ages trying to do this but can't figure out the best way to do it. The date is in the DB as a time() unix timestamp btw $query2 = mysql_query("SELECT * FROM dates WHERE id ='$id' "); while($row2 = mysql_fetch_assoc($query2)){ $date = $row2['date']; echo '<p><a href="book.php?d='.$date.'&f='.$id.'">Book Now</a> for '.date("jS F Y",$date).'</p>'; } Can anyone give me some pointers or suggest the best way to do this?
  6. I have always worked in php on linux servers but I have to transfer someone's windows site to a new host for them. I thought it would be straight forward but now I have the hosting ready with all their files uploaded and have a MS SQL database set up I a) can't figure out where the hell I am supposed to put the new database connection details (php stuff always just has an included config file - simple!) and b) have connected to the MS SQL server with navicat and tried importing the .bak file but it seems to do fuck all! Help!!! CMS they are using is 'Umbraco' btw
  7. Photos can be large files straight from a pro 21mp camera. But the filesize isn't really that much of an issue, it's more to do with the processing. I.e. Uploading the image should work fine...but during the upload if my script runs imagecopyresampled a couple of times to create the 2 smaller images and then sticks a watermark on top, the script will fail. It's just too much going on. So I suppose, back to my original question, what is the "proper" way to write it? Clearly it isn't the way I described above but I can't see another way?!?? Some sort of break sequence somehow? Where it runs each part separately at timed intervals?
  8. In the past, whenever I write an image upload script in php that needs to generate a thumbnail or resized version, I have had to make sure the image is a reasonable size before uploading otherwise you get the old 'allowed memory bytes exceeded' thing. What are my options if I want people to be able to upload a full size image from their camera i.e. a 15-20mb 4000x3000px image and then have a thumbnail and something like 500px wide version for displaying on the site? The large unaltered original needs to be stored as well as it will be used for prints. Is this just not possible with PHP? Or is it down to needing a dedicated server?
  9. Never mind. I was just being thick! Should have been b.advertID not a.id
  10. I have 2 tables. 1 table is 'adverts' and the other table is images. There are multiple images per advert and each image has a column 'advertID' to map it to the correct advert. I am having trouble doing a SELECT statement which to get each advert and it's related images. So far I have tried this but I end up with more images than there should be. SELECT * FROM saleadvert a, images b WHERE b.type = 'sale' AND a.clientID='$clientID' AND a.id = '$advertID' Any help appreciated. The selecting from multiple tables always does my head in!
  11. Ah..thanks. I kept ploughing through it and eventually used mb_substr() in php instead. Not ideal, but it works.
  12. Ok...I am now assuming that LEFT() is producing a [?] symbol because it is counting the number of characters in the database and because several symbols make up a chinese character, it is making the last one a half-done, none-recognisable thing. So...is the fact the data is stored in mysql random looking symbols correct? And if so, how can I use functions like LEFT()?
  13. Arrgh! The text is going into my database as chinese characters and coming out as chinese characters..but in phpmyadmin it looks like a load of gibberish surrounded by html tags. Clearly i am missing something vital here
  14. Ah. It's because there are no spaces between the characters/words/paragraphs. I tried LEFT(CONTENT, 100) AS CONTENT which works but sometimes the last character is the dreaded diamond with a question mark in it. Any ideas???
  15. I am busy translating a site into chinese and one part which uses SUBSTRING_INDEX(CONTENT, ' ', 16) AS CONTENT doesn't seem to be working as expected. It works on the English version but it shows everything in the Chinese version. Do I need to tell MYSQL that its using chinese characters or something?
  16. Well.... writing that actually made me think more logically and I solved it myself within seconds!!! SELECT DISTINCT model FROM vans WHERE manufacturer = (SELECT manufacturer FROM vans ORDER BY manufacturer desc LIMIT 1) ORDER BY model asc"
  17. Basically I am trying to do that literal statement: select column1 from mysql WHERE column2 = (first alphabetically) order by column1 asc There should be multiple results. i.e. column1 is car models, column2 is car manufacturers. So I want to get all models ONLY by the manufacturer that comes first alphabetically. Is there a way to do this before I resort to 2 separate queries?
  18. Thanks all. I eventually did it like so... function mixArrayKeyValue(&$value,$key){$value=$value.$key;} $arrayAB = array_fill(17, 4,'AB'); array_walk($arrayAB, 'mixArrayKeyValue'); $arrayAB2 = array_fill(26, 4,'AB'); array_walk($arrayAB2, 'mixArrayKeyValue'); $mergedArray = array_merge($arrayAB, $arrayAB2); //etc....
  19. how about if I mix array_fill(), array_merge() and range() - surely there must be some way to do this?!?
  20. Can I somehow mix letters with numbers to create an array with range()? e.g. I want my array for postcode ranges such as array('AB1','AB2', 'AB3', 'AB4', 'AB5', 'Ab6', 'AB7', 'AB8', 'IV5', 'IV6', 'IV7', 'IV8', 'IV9', 'IV10'); I know I can do range(1,; but was wondering if there was something along the lines of range("AB1", "AB8");
  21. I have a table where there are multiple rows per order_number. Each row has a column for price and quantity. I want to show a summary e.g. order no: 123, qty: 55, total price: £2222 order no: 454, qty: 65, total price: £2652 etc.... If I use SELECT DISTINCT I can get the rows as one order number per row, but how can I add the price/quantities for each order instead of just getting the single values for these columns?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.