-1

I want to create a script that will display video if the file format of file uploaded by user is video file or image if the file format is image file, I don't have problem with the query and the extension function, but I'm having problem with displaying the result of the image and playing the video, below is the code

<?php
        $file = $row1['file'];
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        if ($ext == 'mp4' || $ext == 'mov' || $ext == 'vob' || $ext == 'mpeg' || $ext == '3gp' || $ext == 'avi' || $ext == 'wmv' || $ext == 'mov' || $ext == 'amv' || $ext == 'svi' || $ext == 'flv' || $ext == 'mkv' || $ext == 'webm' || $ext == 'gif' || $ext == 'asf') {
            echo"<div class='flowplayer' data-swf='flowplayer.swf' data-ratio='0.4167'>";
              echo "<video>";
                 echo"<source type='video/webm' src='https://edge.flowplayer.org/bauhaus.webm' autoplay='autoplay'>";
                 echo"<source type='video/mp4' src='https://edge.flowplayer.org/bauhaus.mp4' autoplay='autoplay'>";
              echo "</video>";
           echo"</div>";
        }else{
            echo"<img src='echo GW_UPLOADPATH.$row1['file'];' class='img-polaroid' alt='Image' width='550px' height='500px' />";
        }
  ?>

but I;m getting Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) error on echo img line

benyusouf
  • 325
  • 2
  • 6
  • 17

2 Answers2

0

You have a syntax error in your code. Try to replace your line with :

echo "<img src='".GW_UPLOADPATH.$row1['file']."' class='img-polaroid' alt='Image' width='550px' height='500px' />";
Guillaume Sainthillier
  • 1,655
  • 1
  • 9
  • 13
0

Per my comment on your question.

Flip the quotes and remove the extra echo, there is semicolon that ive removed.

Change from

echo"<img src='echo GW_UPLOADPATH.$row1['file'];' class='img-polaroid' alt='Image' width='550px' height='500px' />";

To This

echo '<img src="GW_UPLOADPATH . $row1['file']" class="img-polaroid" alt="Image" width="550px" height="500px" />';
CodingInTheUK
  • 930
  • 7
  • 16