LuboEM LuboEM - 1 year ago 573
PHP Question

Change video size from URL?

Helou :)

I have this following code

$koncovka = $_GET["url"];
$url_parsovani = "$koncovka";
$width = "640";
$height = "360";

Once I get on the video URL for example it gives me the preset width and height of the video.

Can you help me to transfer code, so I can change the video size from URL?
For example I would like to use this URL to set the video size to 960x540

Answer Source


$width = "640";
$height = "360";

To the parameters read from the url (don't forget to validate the input).

$width = isset($_GET['width']) && is_numeric($_GET['width']) ? $_GET['width'] : '360';

$height = isset($_GET['height']) && is_numeric($_GET['height']) ? $_GET['height'] : '640';

It checks if there is a GET parameter passed and if it's of numeric type, otherwise is sets to a default value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download