Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (54)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (5001)

  • How to make your plugin configurable – Introducing the Piwik Platform

    18 septembre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to add new pages and menu items to Piwik). This time you will learn how to define settings for your plugin. For this tutorial you will need to have basic knowledge of PHP.

    What can I do with settings ?

    The Settings API offers you a simple way to make your plugin configurable within the Admin interface of Piwik without having to deal with HTML, JavaScript, CSS or CSRF tokens. There are many things you can do with settings, for instance let users configure :

    • connection infos to a third party system such as a WordPress installation.
    • select a metric to be displayed in your widget
    • select a refresh interval for your widget
    • which menu items, reports or widgets should be displayed
    • and much more

    Getting started

    In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.

    To summarize the things you have to do to get setup :

    • Install Piwik (for instance via git).
    • Activate the developer mode : ./console development:enable --full.
    • Generate a plugin : ./console generate:plugin --name="MySettingsPlugin". There should now be a folder plugins/MySettingsPlugin.
    • And activate the created plugin under Settings => Plugins.

    Let’s start creating settings

    We start by using the Piwik Console to create a settings template :

    ./console generate:settings

    The command will ask you to enter the name of the plugin the settings should belong to. I will simply use the above chosen plugin name “MySettingsPlugin”. There should now be a file plugins/MySettingsPlugin/Settings.php which contains already some examples to get you started easily. To see the settings in action go to Settings => Plugin settings in your Piwik installation.

    Adding one or more settings

    Settings are added in the init() method of the settings class by calling the method addSetting() and passing an instance of a UserSetting or SystemSetting object. How to create a setting is explained in the next chapter.

    Customising a setting

    To create a setting you have to define a name along some options. For instance which input field should be displayed, what type of value you expect, a validator and more. Depending on the input field we might automatically validate the values for you. For example if you define available values for a select field then we make sure to validate and store only a valid value which provides good security out of the box.

    For a list of possible properties have a look at the SystemSetting and UserSetting API reference.

    class Settings extends \Piwik\Plugin\Settings
    {
       public $refreshInterval;

       protected function init()
       {
           $this->setIntroduction('Here you can specify the settings for this plugin.');

           $this->createRefreshIntervalSetting();
       }

       private function createRefreshIntervalSetting()
       {
           $this->refreshInterval = new UserSetting('refreshInterval', 'Refresh Interval');
           $this->refreshInterval->type = static::TYPE_INT;
           $this->refreshInterval->uiControlType = static::CONTROL_TEXT;
           $this->refreshInterval->uiControlAttributes = array('size' => 3);
           $this->refreshInterval->description = 'How often the value should be updated';
           $this->refreshInterval->inlineHelp = 'Enter a number which is >= 15';
           $this->refreshInterval->defaultValue = '30';
           $this->refreshInterval->validate = function ($value, $setting) {
               if ($value < 15) {
                   throw new \Exception('Value is invalid');
               }
           };

           $this->addSetting($this->refreshInterval);
       }
    }

    In this example you can see some of those properties. Here we create a setting named “refreshInterval” with the display name “Refresh Interval”. We want the setting value to be an integer and the user should enter this value in a text input field having the size 3. There is a description, an inline help and a default value of 30. The validate function makes sure to accept only integers that are at least 15, otherwise an error in the UI will be shown.

    You do not always have to specify a PHP type and a uiControlType. For instance if you specify a PHP type boolean we automatically display a checkbox by default. Similarly if you specify to display a checkbox we assume that you want a boolean value.

    Accessing settings values

    You can access the value of a setting in a widget, in a controller, in a report or anywhere you want. To access the value create an instance of your settings class and get the value like this :

    $settings = new Settings();
    $interval = $settings->refreshInterval->getValue()

    Type of settings

    The Piwik platform differentiates between UserSetting and SystemSetting. User settings can be configured by any logged in user and each user can configure the setting independently. The Piwik platform makes sure that settings are stored per user and that a user cannot see another users configuration.

    A system setting applies to all of your users. It can be configured only by a user who has super user access. By default, the value can be read only by a super user as well but often you want to have it readable by anyone or at least by logged in users. If you set a setting readable the value will still be only displayed to super users but you will always be able to access the value in the background.

    Imagine you are building a widget that fetches data from a third party system where you need to configure an API URL and token. While no regular user should see the value of both settings, the value should still be readable by any logged in user. Otherwise when logged in users cannot read the setting value then the data cannot be fetched in the background when this user wants to see the content of the widget. Solve this by making the setting readable by the current user :

    $setting->readableByCurrentUser = !Piwik::isUserIsAnonymous();

    Publishing your Plugin on the Marketplace

    In case you want to share your settings or your plugin with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.

    Advanced features

    Isn’t it easy to create settings for plugins ? We never even created a file ! The Settings API already offers many possibilities but it might not yet be as flexible as your use case requires. So let us know in case you are missing something and we hope to add this feature at some point in the future.

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.

  • How to make your plugin configurable – Introducing the Piwik Platform

    18 septembre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to add new pages and menu items to Piwik). This time you will learn how to define settings for your plugin. For this tutorial you will need to have basic knowledge of PHP.

    What can I do with settings ?

    The Settings API offers you a simple way to make your plugin configurable within the Admin interface of Piwik without having to deal with HTML, JavaScript, CSS or CSRF tokens. There are many things you can do with settings, for instance let users configure :

    • connection infos to a third party system such as a WordPress installation.
    • select a metric to be displayed in your widget
    • select a refresh interval for your widget
    • which menu items, reports or widgets should be displayed
    • and much more

    Getting started

    In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.

    To summarize the things you have to do to get setup :

    • Install Piwik (for instance via git).
    • Activate the developer mode : ./console development:enable --full.
    • Generate a plugin : ./console generate:plugin --name="MySettingsPlugin". There should now be a folder plugins/MySettingsPlugin.
    • And activate the created plugin under Settings => Plugins.

    Let’s start creating settings

    We start by using the Piwik Console to create a settings template :

    ./console generate:settings

    The command will ask you to enter the name of the plugin the settings should belong to. I will simply use the above chosen plugin name “MySettingsPlugin”. There should now be a file plugins/MySettingsPlugin/Settings.php which contains already some examples to get you started easily. To see the settings in action go to Settings => Plugin settings in your Piwik installation.

    Adding one or more settings

    Settings are added in the init() method of the settings class by calling the method addSetting() and passing an instance of a UserSetting or SystemSetting object. How to create a setting is explained in the next chapter.

    Customising a setting

    To create a setting you have to define a name along some options. For instance which input field should be displayed, what type of value you expect, a validator and more. Depending on the input field we might automatically validate the values for you. For example if you define available values for a select field then we make sure to validate and store only a valid value which provides good security out of the box.

    For a list of possible properties have a look at the SystemSetting and UserSetting API reference.

    class Settings extends \Piwik\Plugin\Settings
    {
       public $refreshInterval;

       protected function init()
       {
           $this->setIntroduction('Here you can specify the settings for this plugin.');

           $this->createRefreshIntervalSetting();
       }

       private function createRefreshIntervalSetting()
       {
           $this->refreshInterval = new UserSetting('refreshInterval', 'Refresh Interval');
           $this->refreshInterval->type = static::TYPE_INT;
           $this->refreshInterval->uiControlType = static::CONTROL_TEXT;
           $this->refreshInterval->uiControlAttributes = array('size' => 3);
           $this->refreshInterval->description = 'How often the value should be updated';
           $this->refreshInterval->inlineHelp = 'Enter a number which is >= 15';
           $this->refreshInterval->defaultValue = '30';
           $this->refreshInterval->validate = function ($value, $setting) {
               if ($value < 15) {
                   throw new \Exception('Value is invalid');
               }
           };

           $this->addSetting($this->refreshInterval);
       }
    }

    In this example you can see some of those properties. Here we create a setting named “refreshInterval” with the display name “Refresh Interval”. We want the setting value to be an integer and the user should enter this value in a text input field having the size 3. There is a description, an inline help and a default value of 30. The validate function makes sure to accept only integers that are at least 15, otherwise an error in the UI will be shown.

    You do not always have to specify a PHP type and a uiControlType. For instance if you specify a PHP type boolean we automatically display a checkbox by default. Similarly if you specify to display a checkbox we assume that you want a boolean value.

    Accessing settings values

    You can access the value of a setting in a widget, in a controller, in a report or anywhere you want. To access the value create an instance of your settings class and get the value like this :

    $settings = new Settings();
    $interval = $settings->refreshInterval->getValue()

    Type of settings

    The Piwik platform differentiates between UserSetting and SystemSetting. User settings can be configured by any logged in user and each user can configure the setting independently. The Piwik platform makes sure that settings are stored per user and that a user cannot see another users configuration.

    A system setting applies to all of your users. It can be configured only by a user who has super user access. By default, the value can be read only by a super user as well but often you want to have it readable by anyone or at least by logged in users. If you set a setting readable the value will still be only displayed to super users but you will always be able to access the value in the background.

    Imagine you are building a widget that fetches data from a third party system where you need to configure an API URL and token. While no regular user should see the value of both settings, the value should still be readable by any logged in user. Otherwise when logged in users cannot read the setting value then the data cannot be fetched in the background when this user wants to see the content of the widget. Solve this by making the setting readable by the current user :

    $setting->readableByCurrentUser = !Piwik::isUserIsAnonymous();

    Publishing your Plugin on the Marketplace

    In case you want to share your settings or your plugin with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.

    Advanced features

    Isn’t it easy to create settings for plugins ? We never even created a file ! The Settings API already offers many possibilities but it might not yet be as flexible as your use case requires. So let us know in case you are missing something and we hope to add this feature at some point in the future.

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.

  • Applying filter complex fails with something related to audio

    18 septembre 2014, par Alin

    I finally managed to build ffmpeg as detailed in here : https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/ and in the end, I have a ffmpeg library which accepts command arguments.

    I am trying to apply a watermark image over the video so for it I am using preparing this ffmpeg command :

    ffmpeg -i input.avi -i logo.png -filter_complex 'overlay=10:main_h-overlay_h-10' output.avi

    I have first tried it on windows using ffmpeg.exe and the result was as expected.

    I have tried it on android using the compiled android and the output is as follows :

    09-17 22:03:34.455: I/Videokit(18419): Loading native library compiled at 22:33:10 Sep 15 2014
    09-17 22:03:34.455: I/Videokit(18419): Option: ffmpeg
    09-17 22:03:34.455: I/Videokit(18419): Option: -loglevel
    09-17 22:03:34.455: I/Videokit(18419): Option: debug
    09-17 22:03:34.455: I/Videokit(18419): Option: -i
    09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/vid.mp4
    09-17 22:03:34.455: I/Videokit(18419): Option: -i
    09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/logo.png
    09-17 22:03:34.455: I/Videokit(18419): Option: -qscale:v
    09-17 22:03:34.455: I/Videokit(18419): Option: 1
    09-17 22:03:34.455: I/Videokit(18419): Option: -filter_complex
    09-17 22:03:34.455: I/Videokit(18419): Option: overlay=10:main_h-overlay_h-10
    09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/outVid.mp4
    09-17 22:03:34.455: I/Videokit(18419): Running main
    09-17 22:03:34.463: D/Videokit(18419): Splitting the commandline.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '-loglevel' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as option 'loglevel' (set logging level) with argument 'debug'.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '-i' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as input file with argument '/storage/emulated/0/vid.mp4'.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '-i' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as input file with argument '/storage/emulated/0/logo.png'.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '-qscale:v' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as option 'qscale' (use fixed quality scale (VBR)) with argument '1'.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '-filter_complex' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as option 'filter_complex' (create a complex filtergraph) with argument 'overlay=10:main_h-overlay_h-10'.
    09-17 22:03:34.463: D/Videokit(18419): Reading option '/storage/emulated/0/outVid.mp4' ...
    09-17 22:03:34.463: D/Videokit(18419):  matched as output file.
    09-17 22:03:34.463: D/Videokit(18419): Finished splitting the commandline.
    09-17 22:03:34.463: D/Videokit(18419): Parsing a group of options: global .
    09-17 22:03:34.463: D/Videokit(18419): Applying option loglevel (set logging level) with argument debug.
    09-17 22:03:34.463: D/Videokit(18419): Applying option filter_complex (create a complex filtergraph) with argument overlay=10:main_h-overlay_h-10.
    09-17 22:03:34.463: D/Videokit(18419): Successfully parsed a group of options.
    09-17 22:03:34.463: D/Videokit(18419): Parsing a group of options: input file /storage/emulated/0/vid.mp4.
    09-17 22:03:34.463: D/Videokit(18419): Successfully parsed a group of options.
    09-17 22:03:34.463: D/Videokit(18419): Opening an input file: /storage/emulated/0/vid.mp4.
    09-17 22:03:34.612: D/Videokit(18419): Successfully opened the file.
    09-17 22:03:34.612: D/Videokit(18419): Parsing a group of options: input file /storage/emulated/0/logo.png.
    09-17 22:03:34.612: D/Videokit(18419): Successfully parsed a group of options.
    09-17 22:03:34.612: D/Videokit(18419): Opening an input file: /storage/emulated/0/logo.png.
    09-17 22:03:34.620: D/Videokit(18419): Successfully opened the file.
    09-17 22:03:34.620: D/Videokit(18419): Parsing a group of options: output file /storage/emulated/0/outVid.mp4.
    09-17 22:03:34.620: D/Videokit(18419): Applying option qscale:v (use fixed quality scale (VBR)) with argument 1.
    09-17 22:03:34.620: D/Videokit(18419): Successfully parsed a group of options.
    09-17 22:03:34.620: D/Videokit(18419): Opening an output file: /storage/emulated/0/outVid.mp4.
    09-17 22:03:34.627: D/Videokit(18419): Successfully opened the file.
    09-17 22:03:34.643: I/Videokit(18419): Conversion failed!
    09-17 22:03:34.643: I/Videokit(18419): Stream mapping:
    09-17 22:03:34.643: E/Videokit(18419): Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

    The problem is Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height and this is somehow related to audio of the file. I have removed the audio and I get no error.

    ffmpeg -i vid.mp4 returns this :

    Command line:
    ffmpeg -i vid.mp4 -report
    ffmpeg version N-66278-g91459bd Copyright (c) 2000-2014 the FFmpeg developers
     built on Sep 14 2014 22:05:07 with gcc 4.8.3 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
     libavutil      54.  7.100 / 54.  7.100
     libavcodec     56.  1.100 / 56.  1.100
     libavformat    56.  4.101 / 56.  4.101
     libavdevice    56.  0.100 / 56.  0.100
     libavfilter     5.  1.100 /  5.  1.100
     libswscale      3.  0.100 /  3.  0.100
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  0.100 / 53.  0.100
    Splitting the commandline.
    Reading option '-i' ... matched as input file with argument 'vid.mp4'.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Successfully parsed a group of options.
    Parsing a group of options: input file vid.mp4.
    Successfully parsed a group of options.
    Opening an input file: vid.mp4.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] Before avformat_find_stream_info() pos: 19279 bytes read:32768 seeks:0
    [mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] After avformat_find_stream_info() pos: 41952 bytes read:65536 seeks:0 frames:2
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf55.19.104
     Duration: 00:00:14.58, start: 0.023222, bitrate: 1250 kb/s
       Stream #0:0(und), 1, 1/11988: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x640 [SAR 1:1 DAR 1:1], 1099 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 97 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
       Stream #0:2(eng), 0, 1/90000: Data: none (rtp  / 0x20707472), 39 kb/s
       Metadata:
         handler_name    : HintHandler
       Stream #0:3(eng), 0, 1/44100: Data: none (rtp  / 0x20707472), 8 kb/s
       Metadata:
         handler_name    : HintHandler
    Successfully opened the file.
    At least one output file must be specified
    [AVIOContext @ 040e3f40] Statistics: 65536 bytes read, 0 seeks