I know this thread is 5 months old, but if you are looking for this, here is a Vimeo Snippet (tested on Evolution 1.0.5):
<?php
/**
* Snippet Name: vimeo
* Short Desc: Resize video e thumb per embed Vimeo
* Author: Lorenzo Stanco <[email protected]>
* Version: 0.0.1
* Last Edited: 17-10-2011
*/
// ---------------------------------------------------
// CONFIG
// ---------------------------------------------------
// $type: [string], you can use these values:
// - 'id': Video ID
// - 'title': Video Title
// - 'description': Video Description
// - 'url': Video URL
// - 'upload_date': Date of upload
// - 'mobile_url': Video URL for mobile devices
// - 'thumbnail_small': Video Thumb URL (Small)
// - 'thumbnail_medium': Video Thumb URL (Medium)
// - 'thumbnail_large': Video Thumb URL (Large)
// - 'user_name': User Name.
// - 'user_url': User URL
// - 'user_portrait_small': User Thumb URL (Small)
// - 'user_portrait_medium': User Thumb URL (Medium)
// - 'user_portrait_large': User Thumb URL (Large)
// - 'user_portrait_huge': User Thumb URL (Huge)
// - 'stats_number_of_likes': Number of Likes
// - 'stats_number_of_plays': Number of Plays
// - 'stats_number_of_comments': Number of Comments
// - 'duration': Video Duration
// - 'width': Video Width
// - 'height': Video Height
// $tvname: [string] Vimeo share code (embed)
// $width: [int] width dimension in pixel
// $height: [int] height dimension in pixel
//
// ---------------------------------------------------
// EXAMPLES
// ---------------------------------------------------
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`video` &width=`640` &height=`360`]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`id` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`description` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`url` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`upload_date` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`mobile_url` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`thmbnail_small` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`thumbnail_medium` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`thumbnail_large` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_name` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_url` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_portrait_small` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_portrait_medium` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_portrait_large` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`user_portrait_huge` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`stats_number_of_likes` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`stats_number_of_plays` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`stats_number_of_comments` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`duration` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`width` ]]
// [[vimeo? &tvname=`[*video-1:escapemodx*]` &type=`height` ]]
//-----------------------------------------------------
//$video = $modx->getTemplateVarOutput($tvname);
//$video = $video[$tvname];
$video = str_replace(
array('##w#', '##e#', '##a#'),
array('?' , '=', '&' ),
$tvname
);
// Chiedo il player?
if ($type == 'video') {
// Ho già l'embed, cambio solo i parametri di dimensione
if (!empty($width) && !empty($height)) {
$pattern_w = '/ width=["]?([0-9]+)["]?/i';
$pattern_h = '/ height=["]?([0-9]+)["]?/i';
$video = preg_replace($pattern_w, ' width="'.intval($width).'"', $video);
$video = preg_replace($pattern_h, ' height="'.intval($height).'"', $video);
}
// Tolgo il paragrafo descrittivo
$video = preg_replace('/<p>.*?<\\/p>/', '', $video);
return $video;
}
// Chiedo dati API?
if ($type != 'video') {
// Se chiedo "url", chiedo in realtà la thumb
if ($type == 'thumb') $type = 'thumbnail_large';
// Prendo l'ID del video
$id = null;
$pattern = '/^<(iframe|embed).*"http.*?\\/video\\/([a-z0-9]*)/i';
$target_share_code = trim($video);
if (preg_match($pattern, $target_share_code, $id)) {
$id = $id[2];
} else {
return 'Vimeo error.';
}
// Chiedo tutti i dati in formato JSON
$data_url = 'http://vimeo.com/api/v2/video/' . $id . '.php';
$data = @file_get_contents($data_url);
if (!$data) return 'Vimeo error.';
$data = @unserialize($data);
if (!$data) return 'Vimeo error.';
$data = array_pop($data);
if (empty($data)) return 'Vimeo error.';
// Ritorno quello che serve
return $data[$type];
}
return 'Vimeo error.';
?>
You also need the "phx:escapemodx" Snippet:
<?php
return str_replace(
array('?' , '=', '&' ),
array('##w#', '##e#', '##a#'),
$output
);
?>
Note: in the Template Variable you must use the vimeo "embed" code, not the vimeo url.
[ed. note: microcipcip last edited this post 12 years, 4 months ago.]