Recherche avancée

Médias (1)

Mot : - Tags -/vidéo

Autres articles (45)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

Sur d’autres sites (6476)

  • Revision 115730 : Le JS ne prenait même pas en compte que la date de départ pourrait ...

    20 juin 2019, par rastapopoulos@… — Log

    Le JS ne prenait même pas en compte que la date de départ pourrait être vide… du coup même avec datetime, ça faisait une heure vide et donc juste une date, et donc ça plante SQL ensuite si datetime attendue

  • Evolution #2969 : Retourner message_ok et message_erreur sur un traitement CVT

    18 novembre 2013, par cam.lafit -

    Salut

    Oui retourner une erreur si il y a est logique :) Je ne remettais pas
    en doute ce point.
    C’est le fait de ne pouvoir dire que le verre est à moitié plein et à
    moitié vide. Pour le moment c’est soit plein soit vide.

    Si on injecte le résultat positif dans le message d’erreur, il se
    retrouver noyé dans le bloc erreur et ne profite pas de la mise en
    forme réussie. On peut trouver des cas où l’erreur n’interdit pas la
    réussite et vice versa.

  • error with ffmpeg, when trying to upload a video

    14 juillet 2021, par James

    I recently downloaded a script, which is similar to a social network. And all items in this script related to publish, for example. The button to publish images, video and polls are included. However the video upload button has a problem, the host I'm hosting this site doesn't accept ffmpeg conversion, and so far so good because in the script if there isn't you can leave the ffmpeg field (in the adm panel) empty , and I did that, the problem is that when I try to upload a video, I always get an error saying that it was not possible to relazie the operation, I went to take a look at the script to process the video, and found that it uploads because the video goes to the uploads folder, but it doesn't deliver anything to the bank and doesn't even preview the video on the publish page, that is, the ffmpeg code is running even with the host not allowing it, giving an error soon.

    


    I've tried to do everything like deleting the ffmpeg part of the code, trying to change the input names and many other small attempts like changing some name there or here, but the error still persists.

    


    The code is right below, could someone tell me what I can change in this code so that it uploads the normal video ? (this host allows video uploading, but without ffmpeg). And what could be wrong with him ?

    


    I tested it on localhost but everything worked fine

    


    the whole code

    


    <?php 

if (empty($cl['is_logged'])) {
    $data         = array(
        'code'    => 401,
        'data'    => array(),
        'message' => 'Unauthorized Access'
    );
}

else {
    $post_data  = $me['draft_post'];
    $media_type = fetch_or_get($_POST["type"], false);

    if (empty($media_type) || in_array($media_type, array("image", "video")) != true) {
        $data['code']    = 400;
        $data['message'] = "Media file type is missing or invalid";
        $data['data']    = array();
    }

    else {
        if ($media_type == "image") {
            if (not_empty($_FILES['file']) && not_empty($_FILES['file']['tmp_name'])) {
                if (empty($post_data)) {
                    $post_id   = cl_create_orphan_post($me['id'], "image");
                    $post_data = cl_get_orphan_post($post_id);

                    cl_update_user_data($me['id'], array(
                        'last_post' => $post_id
                    ));
                }
                
                if (not_empty($post_data) && $post_data["type"] == "image") {
                    if (empty($post_data['media']) || count($post_data['media']) < 10) {
                        $file_info      =  array(
                            'file'      => $_FILES['file']['tmp_name'],
                            'size'      => $_FILES['file']['size'],
                            'name'      => $_FILES['file']['name'],
                            'type'      => $_FILES['file']['type'],
                            'file_type' => 'image',
                            'folder'    => 'images',
                            'slug'      => 'original',
                            'crop'      => array('width' => 300, 'height' => 300),
                            'allowed'   => 'jpg,png,jpeg,gif'
                        );

                        $file_upload = cl_upload($file_info);

                        if (not_empty($file_upload['filename'])) {
          
                            $img_id      = cl_db_insert(T_PUBMEDIA, array(
                                "pub_id" => $post_data["id"],
                                "type"   => "image",
                                "src"    => $file_upload['filename'],
                                "time"   => time(),
                                "json_data" => json(array(
                                    "image_thumb" => $file_upload['cropped']
                                ),true)
                            ));

                            if (is_posnum($img_id)) {
                                $data['message'] = 'Media file uploaded successfully';
                                $data['code']    = 200;
                                $data['data']    = array(
                                    "media_id"   => $img_id, 
                                    "url"        => cl_get_media($file_upload['cropped']),
                                    "type"       => "Image"
                                );
                            }
                        }
                        else {
                            $data['code']    = 400;
                            $data['message'] = "Something went wrong while saving a uploaded media file. Please check your details and try again";
                            $data['data']    = array();
                        }
                    }
                    else {
                        $data['code']    = 400;
                        $data['message'] = "You cannot attach more than 10 images to a post";
                        $data['data']    = array();
                    }
                }
                else {
                    cl_delete_orphan_posts($me['id']);
                    cl_update_user_data($me['id'],array(
                        'last_post' => 0
                    ));

                    $data['code']    = 500;
                    $data['message'] = "An error occurred while processing your request. Please try again later.";
                    $data['data']    = array();
                }
            }
            else {
                $data['code']    = 500;
                $data['message'] = "Media file is missing or invalid";
                $data['data']    = array();
            }
        }

        else if($media_type == "video") {
            if (not_empty($_FILES['file']) && not_empty($_FILES['file']['tmp_name'])) {
                if (empty($post_data)) {
                    $post_id   = cl_create_orphan_post($me['id'], "video");
                    $post_data = cl_get_orphan_post($post_id);

                    cl_update_user_data($me['id'],array(
                        'last_post' => $post_id
                    ));
                }

                if (not_empty($post_data) && $post_data["type"] == "video") {
                    if (empty($post_data['media'])) {
                        $file_info      =  array(
                            'file'      => $_FILES['file']['tmp_name'],
                            'size'      => $_FILES['file']['size'],
                            'name'      => $_FILES['file']['name'],
                            'type'      => $_FILES['file']['type'],
                            'file_type' => 'video',
                            'folder'    => 'videos',
                            'slug'      => 'original',
                            'allowed'   => 'mp4,mov,3gp,webm',
                        );

                        $file_upload = cl_upload($file_info);
                        $upload_fail = false;
                        $post_id     = $post_data['id'];

                        if (not_empty($file_upload['filename'])) {
                            try {
                                require_once(cl_full_path("core/libs/ffmpeg-php/vendor/autoload.php"));

                                $ffmpeg         = new FFmpeg(cl_full_path($config['ffmpeg_binary']));
                                $thumb_path     = cl_gen_path(array(
                                    "folder"    => "images",
                                    "file_ext"  => "jpeg",
                                    "file_type" => "image",
                                    "slug"      => "poster",
                                ));

                                $ffmpeg->input($file_upload['filename']);
                                $ffmpeg->set('-ss','3');
                                $ffmpeg->set('-vframes','1');
                                $ffmpeg->set('-f','mjpeg');
                                $ffmpeg->output($thumb_path)->ready();
                            } 

                            catch (Exception $e) {
                                $upload_fail = true;
                            }

                            if (empty($upload_fail)) {
                                $vid_id      = cl_db_insert(T_PUBMEDIA, array(
                                    "pub_id" => $post_id,
                                    "type"   => "video",
                                    "src"    => $file_upload['filename'],
                                    "time"   => time(),
                                    "json_data" => json(array(
                                        "poster_thumb" => $thumb_path
                                    ),true)
                                ));

                                if (is_posnum($vid_id)) {
                                    $data['message'] = 'Media file uploaded successfully';
                                    $data['code']    = 200;
                                    $data['data']    = array(
                                        "media_id"   => $vid_id, 
                                        "type"       => "Video",
                                        "source"     => cl_get_media($file_upload['filename']),
                                        "poster"     => cl_get_media($thumb_path),
                                    );
                                }
                            }

                            else {
                                $data['code']    = 400;
                                $data['message'] = "Something went wrong while saving a uploaded media file. Please check your details and try again";
                                $data['data']    = array();
                            }
                        }
                    }
                    else {
                        $data['code']    = 400;
                        $data['message'] = "You cannot attach more than 1 video to a post";
                        $data['data']    = array();
                    }
                }
                else {
                    cl_delete_orphan_posts($me['id']);
                    cl_update_user_data($me['id'], array(
                        'last_post' => 0
                    ));
                }
            }

            else {
                $data['code']    = 500;
                $data['message'] = "Media file is missing or invalid";
                $data['data']    = array();
            }
        }
    }
}


    


    I dosen't made this code so, i dont know nothing about him