dimanche 4 septembre 2022

hi! help me out laravel devs in this query below [closed]

hope so you are doing great.

what topics to cover in PHP before shifting to the framework.

cheers.

give the answer in the best and precise way thank you



via Chebli Mohamed

Laravel ffmpeg failed to execute command

I'm using protonemedia/laravel-ffmpeg package everything works fine on localhost but on the live server, there is an error message shown.

ProtoneMedia\ LaravelFFMpeg\ Exporters\ EncodingException

ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-threads' '12' '-i' '/www/wwwroot/hamza/storage/app/upload/videos/uofH50IWXt3Doqacxkd2tATboUT5gLfVGaAWyvsS.mp4' '-map' '0' '-vcodec' 'libx264' '-b:v' '1000k' '-sc_threshold' '0' '-g' '48' '-hls_playlist_type' 'vod' '-hls_time' '10' '-hls_segment_filename' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000_%05d.ts' '-master_pl_name' 'temporary_segment_playlist_0.m3u8' '-acodec' 'aac' '-b:a' '128k' '/www/wwwroot/hamza/storage/app/streamable_videos/21_0_1000.m3u8': Error Output: ffmpeg version 3.4.11 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --disable-encoder=libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Unrecognized option 'master_pl_name'. Error splitting the argument list: Option not found

I'm using a job to do conversation

ConvertVideoForStreaming.php Job:

<?php

namespace App\Jobs;
set_time_limit(60000);

use FFMpeg;
use Carbon\Carbon;
use App\Models\Video;
use FFMpeg\Format\Video\X264;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Storage;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class ConvertVideoForStreaming implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    public $video;

    public function __construct(Video $video)
    {
        $this->video = $video;
    }

    public function handle()
    {
        // create some video formats...
        $lowBitrateFormat  = (new X264)->setKiloBitrate(500);
        $highBitrateFormat = (new X264)->setKiloBitrate(3000);

        // open the uploaded video from the right disk...
        FFMpeg::fromDisk($this->video->disk)
            ->open($this->video->path)

            // call the 'exportForHLS' method and specify the disk to which we want to export...
            ->exportForHLS()
            ->withRotatingEncryptionKey(function ($filename, $contents) {
                Storage::disk('streamable_keys')->put($filename, $contents);
            })
            // we'll add different formats so the stream will play smoothly
            // with all kinds of internet connections...
            ->addFormat($lowBitrateFormat)
            ->addFormat($highBitrateFormat)

            // call the 'save' method with a filename...
            ->toDisk('streamable_videos')
            ->save($this->video->id . '.m3u8');

        // update the database so we know the convertion is done!
        $this->video->update([
            'converted_for_streaming_at' => Carbon::now(),
        ]);
    }
}

I'm storing the key at custom disk "streamable_keys", and converted videos should be stored in "streamable_videos".

the streamable keys are generated and saved to a directory without any issues, but streamable videos are not saved to the directory.

after some tracks I found that the problem happens in this line of code:

        ->save($this->video->id . '.m3u8');

all the lines before that line work perfectly.

any ideas on how to fix that?

Full error screenshot

ConvertVideoForStreaming.php



via Chebli Mohamed

samedi 3 septembre 2022

vendredi 2 septembre 2022

i use this function but it give me table empty

public function view_details_vide($vide){

    $ets = DB::table('dossier')->leftJoin('rfi', function ($join) {
        $join->on('dossier.code_dossier', '=', 'rfi.code_do');})->leftJoin('rfq', function ($join) {
            $join->on('dossier.code_dossier', '=', 'rfq.code');})->whereNull('rfi.RFI_statut','=',$vide)->orderBy('date_activation','DESC')->first();
     return view('/admin/accueil',['ets'=>$ets]);
}


via Chebli Mohamed

i want to move the images to another directory if the status of the image is 1(active) i am able to move one record but not all

I want a simple guide on how can i transfer the images with active status to another directory here is my code:

Route::get('/', function () {
$path = public_path('images\products');
$allfiles = scandir($path);
$allfiles = array_diff(scandir($path), array('.', '..'));
$files = array();

foreach ($allfiles as $filename) {
    $file= File::get(public_path('images/products/'.$filename));}
    $files[] = [
        "file_name"=>$filename];
        // return $files;
            // return $files;

foreach($files as $file){
    $users = DB::table('tw_products')
    ->where('status', '=', 1)

    ->get('image') ;
if($users = $file['file_name']){
File::copy('images/products/'.$file['file_name'],'images/ActiveProducts/'.$file['file_name']);
    echo "File Moved";
  }
 }
  });

I want to compare the DB items(image and status) if the status of the image = 1 that image will be moved to another directory... I am doing some mistakes i am able to move 1 last product but others are not moving



via Chebli Mohamed

jeudi 1 septembre 2022

laravel5.7 login not working on aws ec2 instance

Code is working from last 3 years, but suddenly login or any other request are not working it redirects me to default page without error message. Same code is working on another server but on aws its misbehaving.

Note - Session is stored in database.

Users are stuck and chasing continuously. Any help would be highly appreciated.



via Chebli Mohamed

I want to read all my received emails and download the attachments in the mail from Gmail through Laravel. I don't want to send email is it possible?

I am working on a project in which I want to read the recieved mails from my gmail account/ or basically i want that attachment linked in a mail i want to downlownload that attachment through my laravel app is it possible if it is then let me know the method how can i do that ....in simple words my task is to get the attachment from the mails and save it in my directory... Thank you for your time!

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"


via Chebli Mohamed