Mambo forums
Forum Home Register Forum Rules FAQ Search Today's Posts Mark Forums Read

Go Back   Mambo CMS Forum > Mambo 4.6 Releases > Administration > WYSIWYG Editors
 

Get flash movie dimensions (width and height) before inserting

This is a discussion on Get flash movie dimensions (width and height) before inserting within the WYSIWYG Editors forums for Mambo.

Reply
 
Thread Tools
Old 17-01-2008, 08:43 AM   #1
pityu
Mambo Noob
 
Join Date: Nov 2007
Posts: 8
Resolved Get flash movie dimensions (width and height) before inserting

Get flash movie dimensions (width and height) before inserting. (It does not work for remote files!)

1) Download the latest stable getid3-1.7.7.zip, unpack and put the second getid3 folder only into your /UserFiles/ folder. (This util is not a small one, but it can analyze a lot of file types. You may delete unnecessary modules, but check dependencies.txt before do it.)

2) Create a new file named measure.php with this content (edit the first line) and put it into your /mambots/editors/mostlyce/jscripts/tiny_mce/plugins/flash/ folder.
PHP Code:
<?php
$mymain 
"/absolute/path/to/your_domain/"
$url $_REQUEST['url'];
if (
$url && substr_count($url,'.') > 0)
$ext substr($urlstrrpos($url'.') + 1); // get file extension
if ($ext == "swf" && substr_count($url,'UserFiles/') > 0) { // analyze local swf file dimensions only
require_once($mymain.'UserFiles/getid3/getid3.php'); // absolute path to getid3.php
// convert url to absolute path
if (substr_count($url,'http://') > 0) { // from filemanager
$mypath substr($urlstrrpos($url'U'));
$mypath $mymain.$mypath;
} else { 
// manually written
$mypath str_replace('../',$mymain,$url);
}
if (
file_exists($mypath)) { // check file exists
$getID3 = new getID3;
$ThisFileInfo $getID3->analyze($mypath);
getid3_lib::CopyTagsToComments($ThisFileInfo);
$width = @$ThisFileInfo['video']['resolution_x'];
$height = @$ThisFileInfo['video']['resolution_y'];
} else {
$width "undefined";
$height "undefined";
}
} else {
$width "undefined";
$height "undefined";
}
?>
<html><head>
<script languge="javascript" type="text/javascript">
function passValue() {
window.opener.document.forms[0].width.value="<?php echo $width;?>";
window.opener.document.forms[0].height.value="<?php echo $height;?>";
window.close();
}
</script>
<head><body onload="javascript:passValue();">Please wait...</body></html>
3) Modify the /mambots/editors/mostlyce/jscripts/tiny_mce/plugins/flash/flash.htm

Put this into head section:
Code:
<script language="javascript" type="text/javascript">
function getDimensions()
{
var myfile = document.forms[0].file.value;
if (myfile)
window.open('measure.php?url=' + myfile,'','width=200,height=200,left=200,top=200,scrollbars=no,menubars=no,resizable=no,statusbar=no');
}
</script>
Insert a link somewhere into body section:
Code:
<a href="javascript:void(0)" onclick="javascript:getDimensions();">Get dimensions</a>
pityu is offline   Reply With Quote
Old 01-12-2008, 07:13 AM   #2
FDisk
Mambo Noob
 
Join Date: Dec 2008
Posts: 1
Re: Get flash movie dimensions (width and height) before inserting

PHP Code:
<?php
    $file 
basename($_GET['file']);

    
$info getimagesize('flash/'.$file);

    
$width $info[0];
    
$height $info[1];
?>
Just use this
FDisk is offline   Reply With Quote
Old 10-07-2009, 02:56 PM   #3
Wolf_22
Mambo Noob
 
Join Date: Jul 2009
Posts: 1
Re: Get flash movie dimensions (width and height) before inserting

Originally Posted by FDisk View Post
PHP Code:
<?php
    $file 
basename($_GET['file']);

    
$info getimagesize('flash/'.$file);

    
$width $info[0];
    
$height $info[1];
?>
Just use this
That won't work.
Wolf_22 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 09:08 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Mambo Foundation, Inc © 2000 - 2008 All rights reserved. Mambo is Free Software released under the GNU/GPL License.

Managed Servers by DedicatedNOW