
Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (56)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Changer son thème graphique
22 février 2011, parLe thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
Modifier le thème graphique utilisé
Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
Il suffit ensuite de se rendre dans l’espace de configuration du (...)
Sur d’autres sites (10049)
-
Evolution #4301 (Nouveau) : Permettre de ne pas installer les plugins_dist qui sont en option
1er mars 2019, par Franck DHello
Certains plugins_dist ne sont pas obligatoire au fonctionnement de spip, Quand c’est le cas, l’utilisateur devrait pouvoir faire le choix de ne pas installer les plugs.
Un truc du genre, un questionnaire du type case à cocher avec le texte voulez-vous installer les plugins suivants :
(toutes les cases seraient cocher nativement car cela représentera sans doute le plus grand nombre d’utilisateurs)En plus, nous avons un dépôt pour les plugins_dist https://plugins.spip.net/spip.php?page=depots
Par contre, je ne sais pas si cela téléchargerait le trunk ou la version stable ???Franck
-
Using dragonfly and ffmpeg to process a video in Rails
26 novembre 2015, par MaikellI am writing a Ruby on Rails 4 Web application, that gives the user an image-upload functionality. For this I followed this tutorial, which is using the gems
dragonfly
jquery-fileupload-rails
remotipartThis is working fine.
Now I want to extend the image-upload functionality, to upload videos as well. But unfortunately I’m stuck with it. Here is what I have tried so far :config/initializers/dragonfly.rb
require 'dragonfly'
# Configure
Dragonfly.app.configure do
plugin :imagemagick
secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'
url_format '/media/:job/:name'
datastore :file,
root_path: Rails.root.join('uploads/images/'),
server_root: Rails.root.join('uploads')
end
Dragonfly.app(:videos).configure do
secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'
url_format "/media/:job/:name"
datastore :file,
root_path: Rails.root.join('uploads/videos/'),
server_root: Rails.root.join('uploads')
end
# Logger
Dragonfly.logger = Rails.logger
# Mount as middleware
Rails.application.middleware.use Dragonfly::Middleware
# Add model functionality
if defined?(ActiveRecord::Base)
ActiveRecord::Base.extend Dragonfly::Model
ActiveRecord::Base.extend Dragonfly::Model::Validations
endmodels/video.rb
class Video < ActiveRecord::Base
dragonfly_accessor :video, app_name: :videos do
storage_options do |video|
{ path: "videos/#{Video.gen_uuid}-#{video.name}.webm" }
end
end
endI upload the video with ajax. It is succesfully saved in the systems /tmp-directory. Than in the video-controller I call
@video = Video.new[video_params]
@video.saveNow the video-params are correctly saved in the database, but the video is not saved in the given directory
/uploads/videos
Also my goal is, to process the video with ffmpeg, to convert it to a webm. ffmpeg is installed in the system and converting a video on the command line works fine.- But how do I get dragonfly to start the conversion process and save the video in the rails project ? Where do I have to put the ffmpeg-commands to dragonfly ?
- Why does dragonfly not save the video in the directory
uploads/videos
?
Everything works fine with images and imagemagick. Only videos are causing problems.
-
Track API calls in Node.js with Piwik
When using Piwik for analytics, sometimes you don’t want to track only your website’s visitors. Especially as modern web services usually offer RESTful APIs, why not use Piwik to track those requests as well ? It really gives you a more accurate view on how users interact with your services : In which ways do your clients use your APIs compared to your website ? Which of your services are used the most ? And what kind of tools are consuming your API ?
If you’re using Node.js as your application platform, you can use piwik-tracker. It’s a lightweight wrapper for Piwik’s own Tracking HTTP API, which helps you tracking your requests.
First, start with installing
piwik-tracker
as a dependency for your project :npm install piwik-tracker --save
Then create a new tracking instance with your Piwik URL and the site ID of the project you want to track. As Piwik requires a fully qualified URL for analytics, add it in front of the actual request URL.
var PiwikTracker = require('piwik-tracker');
// Initialize with your site ID and Piwik URL
var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php');
// Piwik works with absolute URLs, so you have to provide protocol and hostname
var baseUrl = 'http://example.com';
// Track a request URL:
piwik.track(baseUrl + req.url);Of cause you can do more than only tracking simple URLs : All parameters offered by Piwik’s Tracking HTTP API Reference are supported, this also includes custom variables. During Piwik API calls, those are referenced as JSON string, so for better readability, you should use
JSON.stringify({})
instead of manual encoding.piwik.track({
// The full request URL
url: baseUrl + req.url,
// This will be shown as title in your Piwik backend
action_name: 'API call',
// User agent and language settings of the client
ua: req.header('User-Agent'),
lang: req.header('Accept-Language'),
// Custom request variables
cvar: JSON.stringify({
'1': ['API version', 'v1'],
'2': ['HTTP method', req.method]
})
});As you can see, you can pass along arbitrary fields of a Node.js request object like HTTP header fields, status code or request method (GET, POST, PUT, etc.) as well. That should already cover most of your needs.
But so far, all requests have been tracked with the IP/hostname of your Node.js application. If you also want the API user’s IP to show up in your analytics data, you have to override Piwik’s default setting, which requires your secret Piwik token :
function getRemoteAddr(req) {
if (req.ip) return req.ip;
if (req._remoteAddress) return req._remoteAddress;
var sock = req.socket;
if (sock.socket) return sock.socket.remoteAddress;
return sock.remoteAddress;
}
piwik.track({
// …
token_auth: '<YOUR SECRET API TOKEN>',
cip: getRemoteAddr(req)
});As we have now collected all the values that we wanted to track, we’re basically done. But if you’re using Express or restify for your backend, we can still go one step further and put all of this together into a custom middleware, which makes tracking requests even easier.
First we start off with the basic code of our new middleware and save it as
lib/express-piwik-tracker.js
:// ./lib/express-piwik-tracker.js
var PiwikTracker = require('piwik-tracker');
function getRemoteAddr(req) {
if (req.ip) return req.ip;
if (req._remoteAddress) return req._remoteAddress;
var sock = req.socket;
if (sock.socket) return sock.socket.remoteAddress;
return sock.remoteAddress;
}
exports = module.exports = function analytics(options) {
var piwik = new PiwikTracker(options.siteId, options.piwikUrl);
return function track(req, res, next) {
piwik.track({
url: options.baseUrl + req.url,
action_name: 'API call',
ua: req.header('User-Agent'),
lang: req.header('Accept-Language'),
cvar: JSON.stringify({
'1': ['API version', 'v1'],
'2': ['HTTP method', req.method]
}),
token_auth: options.piwikToken,
cip: getRemoteAddr(req)
});
next();
}
}Now to use it in our application, we initialize it in our main
app.js
file :// app.js
var express = require('express'),
piwikTracker = require('./lib/express-piwik-tracker.js'),
app = express();
// This tracks ALL requests to your Express application
app.use(piwikTracker({
siteId : 1,
piwikUrl : 'http://mywebsite.com/piwik.php',
baseUrl : 'http://example.com',
piwikToken: '<YOUR SECRET API TOKEN>'
}));This will now track each request going to every URL of your API. If you want to limit tracking to a certain path, you can also attach it to a single route instead :
var tracker = piwikTracker({
siteId : 1,
piwikUrl : 'http://mywebsite.com/piwik.php',
baseUrl : 'http://example.com',
piwikToken: '<YOUR SECRET API TOKEN>'
});
router.get('/only/track/me', tracker, function(req, res) {
// Your code that handles the route and responds to the request
});And that’s everything you need to track your API users alongside your regular website users.