Changeset 17310 for extensions
- Timestamp:
- Aug 2, 2012, 4:30:30 PM (12 years ago)
- Location:
- extensions/gvideo
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/admin/add.php
r17307 r17310 57 57 if (count($page['errors']) == 0) 58 58 { 59 if (isset($_POST['add_film_frame'])) 60 { 61 add_film_frame($thumb_source); 62 } 63 59 64 // add image and update infos 60 65 $image_id = add_uploaded_file($thumb_source, $thumb_name, array($_POST['category'])); -
extensions/gvideo/admin/template/add.tpl
r17307 r17310 4 4 jQuery("input[data-toggle]").change(function() { 5 5 $('#'+ $(this).data('toggle')).toggle(); 6 }); 7 jQuery(".showInfo").tipTip({ 8 delay: 0, 9 fadeIn: 200, 10 fadeOut: 200, 11 maxWidth: '300px', 12 defaultPosition: 'right' 6 13 }); 7 14 {/literal}{/footer_script} … … 40 47 </li> 41 48 <li> 42 43 44 49 <span class="property">{'Author'|@translate}</span> 50 <label><input type="radio" name="author_server" value="true" {if $POST.author_server != 'false'}checked="checked"{/if} data-toggle="author"> {'From the video'|@translate}</label> 51 <label><input type="radio" name="author_server" value="false" {if $POST.author_server == 'false'}checked="checked"{/if} data-toggle="author"> {'Change'|@translate}</label> 45 52 </li> 46 53 <li {if $POST.author_server != 'false'}style="display:none;"{/if} id="author"> … … 58 65 </li> 59 66 <li> 60 <label> 61 <span class="property">{'Thumbnail'|@translate}</span> 62 <label><input type="radio" name="thumbnail_server" value="true" checked="checked" data-toggle="thumbnail_src"> {'From the video'|@translate}</label> 63 <label><input type="radio" name="thumbnail_server" value="false" data-toggle="thumbnail_src"> {'Change'|@translate}</label> 64 </label> 67 <span class="property">{'Thumbnail'|@translate}</span> 68 <label><input type="radio" name="thumbnail_server" value="true" checked="checked" data-toggle="thumbnail_src"> {'From the video'|@translate}</label> 69 <label><input type="radio" name="thumbnail_server" value="false" data-toggle="thumbnail_src"> {'Change'|@translate}</label> 65 70 </li> 66 71 <li id="thumbnail_src" style="display:none;"> … … 70 75 {'Maximum file size: %sB.'|@translate|@sprintf:$upload_max_filesize_shorthand} {'Allowed file types: %s.'|@translate|@sprintf:'jpg, png, gif'} 71 76 <input type="hidden" name="MAX_FILE_SIZE" value="{$upload_max_filesize}"> 77 </li> 78 <li> 79 <span class="property"> </span> 80 <label><input type="checkbox" name="add_film_frame" value="true"> {'Add film effect'|@translate} </label> 81 <a class="showInfo" title="<img src='{$GVIDEO_PATH}admin/template/example-frame.jpg'>">i</a> 72 82 </li> 73 83 </ul> -
extensions/gvideo/admin/template/style.css
r17307 r17310 42 42 visibility:hidden; 43 43 } 44 45 .showInfo { 46 position:static; 47 display:inline-block; 48 padding:1px 7px; 49 width:4px; 50 height:16px; 51 line-height:16px; 52 font-size:0.8em; 53 } -
extensions/gvideo/include/functions.inc.php
r17307 r17310 289 289 } 290 290 291 /** 292 * and film frame to an image (need GD library) 293 * @param: string source 294 * @param: string destination (if null, the source si modified) 295 * @return: void 296 */ 297 function add_film_frame($src, $dest=null) 298 { 299 if (empty($dest)) 300 { 301 $dest = $src; 302 } 303 304 // we need gd library 305 if (!function_exists('imagecreatetruecolor')) 306 { 307 if ($dest != $src) copy($src, $dest); 308 return; 309 } 310 311 // open source image 312 $imgExt = strtolower(get_extension($src)); 313 switch ($imgExt) 314 { 315 case 'jpg': 316 case 'jpeg': 317 $srcImage = imagecreatefromjpeg($src); 318 break; 319 case 'png': 320 $srcImage = imagecreatefrompng($src); 321 break; 322 case 'gif': 323 $srcImage = imagecreatefromgif($src); 324 break; 325 default: 326 if ($dest != $src) copy($src, $dest); 327 return; 328 } 329 330 // source properties 331 $srcWidth = imagesx($srcImage); 332 $srcHeight = imagesy($srcImage); 333 $const = intval($srcWidth * 0.04); 334 $bandRadius = floor($const/8); 335 336 // band properties 337 $imgBand = imagecreatetruecolor($srcWidth + 6*$const, $srcHeight + 3*$const); 338 339 $black = imagecolorallocate($imgBand, 0, 0, 0); 340 $white = imagecolorallocate($imgBand, 245, 245, 245); 341 342 // and dots 343 $y_start = intval(($srcHeight + 3*$const) / 2); 344 $aug = intval($y_start / 5) + 1; 345 $i = 0; 346 347 while ($y_start + $i*$aug < $srcHeight + 3*$const) 348 { 349 imagefilledroundrectangle($imgBand, (3/4)*$const, $y_start + $i*$aug - $const/2, (9/4)*$const - 1, $y_start + $i*$aug + $const/2 - 1, $white, $bandRadius); 350 imagefilledroundrectangle($imgBand, (3/4)*$const, $y_start - $i*$aug - $const/2, (9/4)*$const - 1, $y_start - $i*$aug + $const/2 - 1, $white, $bandRadius); 351 352 imagefilledroundrectangle($imgBand, $srcWidth + (15/4)*$const, $y_start + $i*$aug - $const/2, $srcWidth + (21/4)*$const - 1, $y_start + $i*$aug + $const/2 - 1, $white, $bandRadius); 353 imagefilledroundrectangle($imgBand, $srcWidth + (15/4)*$const, $y_start - $i*$aug - $const/2, $srcWidth + (21/4)*$const - 1, $y_start - $i*$aug + $const/2 - 1, $white, $bandRadius); 354 355 ++$i; 356 } 357 358 // add source to band 359 imagecopy($imgBand, $srcImage, 3*$const, (3/2)*$const, 0, 0, $srcWidth, $srcHeight); 360 361 // save image 362 switch ($imgExt) 363 { 364 case 'jpg': 365 case 'jpeg': 366 imagejpeg($imgBand, $dest); 367 break; 368 case 'png': 369 imagepng($imgBand, $dest); 370 break; 371 case 'gif': 372 imagegif($imgBand, $dest); 373 break; 374 } 375 } 376 377 /** 378 * create a rectangle with round corners 379 * http://www.php.net/manual/fr/function.imagefilledrectangle.php#42815 380 */ 381 function imagefilledroundrectangle(&$img, $x1, $y1, $x2, $y2, $color, $radius) 382 { 383 imagefilledrectangle($img, $x1+$radius, $y1, $x2-$radius, $y2, $color); 384 385 if ($radius > 0) 386 { 387 imagefilledrectangle($img, $x1, $y1+$radius, $x2, $y2-$radius, $color); 388 imagefilledellipse($img, $x1+$radius, $y1+$radius, $radius*2, $radius*2, $color); 389 imagefilledellipse($img, $x2-$radius, $y1+$radius, $radius*2, $radius*2, $color); 390 imagefilledellipse($img, $x1+$radius, $y2-$radius, $radius*2, $radius*2, $color); 391 imagefilledellipse($img, $x2-$radius, $y2-$radius, $radius*2, $radius*2, $color); 392 } 393 } 394 291 395 ?> -
extensions/gvideo/language/en_UK/plugin.lang.php
r17307 r17310 20 20 $lang['Video successfully added. <a href="%s">View</a>'] = 'Video successfully added. <a href="%s">View</a>'; 21 21 $lang['This element is a video added with "Embedded Video"'] = 'This element is a video added with "Embedded Video"'; 22 $lang['Add film effect'] = 'Add film effect'; 22 23 23 24 ?> -
extensions/gvideo/language/fr_FR/plugin.lang.php
r17307 r17310 20 20 $lang['Video successfully added. <a href="%s">View</a>'] = 'Vidéo ajoutée. <a href="%s">Voir</a>'; 21 21 $lang['This element is a video added with "Embedded Video"'] = 'Cet élément est une vidéo ajoutée avec "Embedded Video"'; 22 $lang['Add film effect'] = 'Ajouter un effet pellicule'; 22 23 23 24 ?> -
extensions/gvideo/maintain.inc.php
r17307 r17310 179 179 $thumb_source = $conf['data_location'].get_filename_wo_extension($thumb_name).'.jpg'; 180 180 copy(gvideo_path.'mimetypes/'.$video['type'].'.jpg', $thumb_source); 181 add_film_frame($thumb_source); 181 182 } 182 183 }
Note: See TracChangeset
for help on using the changeset viewer.