logged_with_bugmenot Posted August 11, 2006 Share Posted August 11, 2006 I have a site where users can upload video to their posts. I then display this video using the <embed> tag.[code]<embed src="video.wmv">[/code]Any video format is allowed. The problem is that I don't know how to get the height and width of the video with PHP. Without defining height="x" and width="x", the video shows up very small. I don't want to use a static height and width in my embed tag. So how can I get the dimensions of a video with PHP, or what alternative is there to make the video show up in the page with the correct size?[code]<embed src="video.wmv" height="???" width="???">[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/ Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 Uhhh if height and width tags arent passed the actual height and width are used i think... So getting them isnt gonna do you any good unless you plan to double them or something... Lemme search google real quick... http://chattyfig.figleaf.com/pipermail/flashcoders/2006-May/166365.html has something bout gettin the width and height of a flash file... Ill test it real qucik on a .wmv and see if it works... Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72881 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 Wow, hmmm so that doesnt even work for flash... lol... google failed me!!!!! no!!!!!!!!!!!!!!!!!!!!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72882 Share on other sites More sharing options...
redarrow Posted August 11, 2006 Share Posted August 11, 2006 my example that does work from the database.[code]<?php$video_query="SELECT * from members_video_uploads where id='$id'";$video_result=mysql_query($video_query);while($vid=mysql_fetch_assoc($video_result)) {?><td align="center"><b>members video</b><br><br><object width="125" height="125" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id="mediaplayer1"><param name="filename" value="members_video/<?php echo $vid["userfile_name"];?>"><param name="AutoStart" value="false"><param name="ShowControls" value="true"><br><param name="ShowStatusBar" value="False"><param name="ShowDisplay" value="false"><param name="AutoRewind" value="True"><embed type="application/x-mplayer2"filename="kids.mpg" autostart="True" showcontrols="True" showstatusbar="False" showdisplay="False" autorewind="True"></embed></object><?}if(mysql_num_rows($video_result)==0){echo'<td align="center"><b>members video</b><br><br><img width="125" height="125" src="images/novid.png"></img>';}?>[/code]and this is correct example as well.[code]<ENBED src="video.wmv" HEIGHT=100 WIDTH=100>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72893 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 I dont think hes having an issue with that aspect of it... I think hes having trouble cuz he needs to know the width and height of the file... Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72928 Share on other sites More sharing options...
redarrow Posted August 11, 2006 Share Posted August 11, 2006 how can anyone no the width and height of the video file you set the width and height.i understand if the user wanted filesize but not your ansaw corbin Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72929 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 [quote author=logged_with_bugmenot link=topic=103805.msg413611#msg413611 date=1155269175]I have a site where users can upload video to their posts. I then display this video using the <embed> tag.[code]<embed src="video.wmv">[/code]Any video format is allowed. The problem is that I don't know how to get the height and width of the video with PHP. Without defining height="x" and width="x", the video shows up very small. I don't want to use a static height and width in my embed tag. So how can I get the dimensions of a video with PHP, or what alternative is there to make the video show up in the page with the correct size?[code]<embed src="video.wmv" height="???" width="???">[/code][/quote]It wasnt me asking the question. I'm sorry if you misunderstood my 'ansaw' Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72934 Share on other sites More sharing options...
redarrow Posted August 11, 2006 Share Posted August 11, 2006 Theres no other way else using static height= and width=.sorry corbin silly quistion sorry mate. Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-72939 Share on other sites More sharing options...
logged_with_bugmenot Posted August 11, 2006 Author Share Posted August 11, 2006 I know that you can use getimagesize() to get the dimensions of an image or flash file, but it doesn't work for videos. The reason I need to get the height and width of the video is because I want to allow the video to be up to 500 height and 500 width. If the dimensions are lower than that, I stick with them. If either the height or width goes above 500, then I choose new proportional dimensions to make it fit in the 500x500 space. I tried removing the height and width properties of the embed tag and the video shows up as the correct size in IE. But in Firefox and Opera, it is very tiny and is not the correct size. How can I make Firefox and Opera use the right size automatically? Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-73201 Share on other sites More sharing options...
logged_with_bugmenot Posted August 11, 2006 Author Share Posted August 11, 2006 Here is an image explaining the problem with the sizes http://img65.imageshack.us/img65/8650/videosizespe7.png[attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-73206 Share on other sites More sharing options...
corbin Posted August 11, 2006 Share Posted August 11, 2006 Theyre all porportional so you could just have them all as x by y no matter what... It would look kinda wierd on some of em but youre site would end up lookin better anyways... Someone might think its funny to upload some 2000x2000 file... making the page its on look like crap... Quote Link to comment https://forums.phpfreaks.com/topic/17204-get-height-and-width-of-uploaded-video/#findComment-73210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.