scratch – Diff between revs 108 and 110
?pathlinks?
Rev 108 | Rev 110 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | ########################################################################### |
5 | ########################################################################### |
|
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | require_once('php/pseudocrypt.php'); |
7 | require_once('php/pseudocrypt.php'); |
|
8 | require_once('php/functions.php'); |
8 | require_once('php/functions.php'); |
|
- | 9 | require_once('vendor/autoload.php'); |
||
Line 9... | Line 10... | |||
9 | require_once('vendor/autoload.php'); |
10 | require_once('vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php'); |
|
10 | |
11 | |
|
Line 11... | Line 12... | |||
11 | ### Load configuration. |
12 | ### Load configuration. |
|
Line 64... | Line 65... | |||
64 | die('File not found.'); |
65 | die('File not found.'); |
|
65 | } |
66 | } |
|
Line 66... | Line 67... | |||
66 | |
67 | |
|
67 | $GRAPH_URL = $config['URL_PATH'].'og/'.$_GET['hash']; |
68 | $GRAPH_URL = $config['URL_PATH'].'og/'.$_GET['hash']; |
|
68 | $CANON_URL = $config['URL_PATH'].'file.php?hash='.$_GET['hash']; |
69 | $CANON_URL = $config['URL_PATH'].'file.php?hash='.$_GET['hash']; |
|
Line 69... | Line 70... | |||
69 | $URL = $config['URL_PATH'].$_GET['hash']; |
70 | $BASIC_URL = $config['URL_PATH'].$_GET['hash']; |
|
70 | |
71 | |
|
71 | switch(strtoupper($fileExtension)) { |
72 | switch(strtoupper($fileExtension)) { |
|
72 | case 'GIF': |
73 | case 'GIF': |
|
73 | list($width, $height) = getimagesize($userPath); |
74 | list($width, $height) = getimagesize($userPath); |
|
74 | echo <<<END |
75 | echo <<<END |
|
75 | <html> |
76 | <html> |
|
76 | <head> |
77 | <head> |
|
77 | <meta property="og:site_name" content="Scratch Copy"> |
78 | <meta property="og:site_name" content="Scratch Copy"> |
|
78 | <meta property="og:url" content="$URL"> |
79 | <meta property="og:url" content="$BASIC_URL"> |
|
79 | <meta property="og:title" content="Scratch Copy"> |
80 | <meta property="og:title" content="Scratch Copy"> |
|
80 | <meta property="og:type" content="video.other"> |
81 | <meta property="og:type" content="video.other"> |
|
81 | <meta property="og:image" content="$URL"> |
82 | <meta property="og:image" content="$BASIC_URL"> |
|
82 | <meta property="og:image:width" content="$width"> |
83 | <meta property="og:image:width" content="$width"> |
|
Line 83... | Line 84... | |||
83 | <meta property="og:image:height" content="$height"> |
84 | <meta property="og:image:height" content="$height"> |
|
Line 91... | Line 92... | |||
91 | |
92 | |
|
92 | </html> |
93 | </html> |
|
93 | END; |
94 | END; |
|
94 | break; |
95 | break; |
|
- | 96 | case 'MP4': |
||
- | 97 | ### Create a thumbnail for the video. |
||
- | 98 | $file = strtolower( |
||
- | 99 | PseudoCrypt::hash( |
||
- | 100 | preg_replace( |
||
- | 101 | '/\D/', |
||
- | 102 | '', |
||
- | 103 | hash( |
||
- | 104 | 'sha512', |
||
- | 105 | $_GET['hash'] |
||
- | 106 | ) |
||
- | 107 | ), |
||
- | 108 | $config['ASSET_HASH_SIZE'] |
||
- | 109 | ) |
||
- | 110 | ); |
||
- | 111 | |
||
- | 112 | #### Build the user path. |
||
- | 113 | $userPath = join( |
||
- | 114 | DIRECTORY_SEPARATOR, |
||
- | 115 | array( |
||
- | 116 | $config['STORE_FOLDER'], |
||
- | 117 | $file |
||
- | 118 | ) |
||
- | 119 | ); |
||
- | 120 | |
||
- | 121 | ### Extract thumbnail. |
||
- | 122 | $ffmpeg = FFMpeg\FFMpeg::create(); |
||
- | 123 | $video = $ffmpeg->open($CANON_URL); |
||
- | 124 | $frame = $video->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(42)); |
||
95 | case 'MP4': |
125 | $frame->save($userPath.'.'.'jpg'); |
|
96 | echo <<<END |
126 | echo <<<END |
|
97 | <html> |
127 | <html> |
|
98 | <head> |
128 | <head> |
|
99 | <meta property="og:type" content="video.other"> |
129 | <meta property="og:type" content="video.other"> |
|
100 | <meta property="og:title" content="Scratch Copy"> |
130 | <meta property="og:title" content="Scratch Copy"> |
|
Line 101... | Line 131... | |||
101 | <meta property="og:site_name" content="Scratch Copy"> |
131 | <meta property="og:site_name" content="Scratch Copy"> |
|
Line 102... | Line 132... | |||
102 | |
132 | |
|
103 | <meta property="og:url" content="$GRAPH_URL"> |
133 | <meta property="og:url" content="$GRAPH_URL"> |
|
104 | |
134 | |
|
105 | <meta property="og:image" content="https://cpy.ro/img/blueprint.png"> |
135 | <meta property="og:image" content="https://cpy.ro/$file"> |
|
106 | <meta property="og:video" content='http://cpy.ro/flowplayer/flowplayer.swf?config={"clip":"$URL"}'> |
136 | <meta property="og:video" content='http://cpy.ro/flowplayer/flowplayer.swf?config={"clip":"$BASIC_URL"}'> |
|
107 | <meta property="og:video:secure_url" content='https://cpy.ro/flowplayer/flowplayer.swf?config={"clip":"$URL"}'> |
137 | <meta property="og:video:secure_url" content='https://cpy.ro/flowplayer/flowplayer.swf?config={"clip":"$BASIC_URL"}'> |
|
108 | <meta property="og:video:type" content="application/x-shockwave-flash"> |
138 | <meta property="og:video:type" content="application/x-shockwave-flash"> |
|
Line 109... | Line 139... | |||
109 | <meta property="og:video:width" content="425"> |
139 | <meta property="og:video:width" content="425"> |
|
110 | <meta property="og:video:height" content="300"> |
140 | <meta property="og:video:height" content="300"> |
|
111 | </head> |
141 | </head> |
|
112 | |
142 | |
|
113 | <body> |
143 | <body> |
|
Line 114... | Line 144... | |||
114 | <p> |
144 | <p> |
|
115 | <object width="425" height="300" id="Scratch Copy" name="Scratch Copy" data="https://cpy.ro/flowplayer/flowplayer.swf" type="application/x-shockwave-flash"><param name="movie" value="https://cpy.ro/flowplayer/flowplayer.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value='config={"clip":"$URL"}' /></object> |
145 | <object width="425" height="300" id="Scratch Copy" name="Scratch Copy" data="https://cpy.ro/flowplayer/flowplayer.swf" type="application/x-shockwave-flash"><param name="movie" value="https://cpy.ro/flowplayer/flowplayer.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value='config={"clip":"$BASIC_URL"}' /></object> |