Hi guys,

I have created a site where users can upload videos(mp4) and images(jpg & gif).
The upload script sends the uploaded file to a folder on a remote server, and the filepath is stored in MYSQL.

Can any one tell how i go about playing the stored videos or show the stored images?

Also does anyone know how i can create thumbnails for uploaded videos?

any help or advice will be much appreciated...


Thanks,

Hey.

To show the images, the general idea is:

<?php
$dbLink = new mysqli('localhost', 'usr', 'pwd', 'dbName');
if(mysqli_connect_errno()) {
    die('Failed to connect to MySQL: ' . mysqli_connect_error());
}

$sql = "SELECT `image_path`, `image_name` FROM `images`";
$result = $dbLink->query($sql);

if($result)
{
    while($row = $result->fetch_assoc())
    {
        echo "<img src='{$row['image_path']}' alt='{$row['image_name']}' /><br>";
    }
}
else
{
    echo "MySQL query failed: " . $dbLink->error;
}
?>

Same goes for the videos, except you would use whatever video playback mechanism you use instead of the <img> tag.

As for the thumbnails, I'm afraid I can't say. Haven't worked much with videos so far.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.