I have to upload different video files on my codeigniter but I couldn't upload mp4 and flv.
I have tried with adding mp4 mime type in config/mimes but in vain.
'mp4' => array('video/mp4', 'video/3gpp'),
Please let me know the best solution.
Thanks is advance
Try:
$config['allowed_types'] = '*';
Related
I have added Imagick library and tried to upload .heic image
$image = new \Imagick();
$image->readImage($request->image);
And always return this error
NoDecodeDelegateForThisImageFormat `HEIC' # error/constitute.c/ReadImage/509
I tried a lot of solutions but nothing works.
phpinfo
I solved the problem by adding this library then I make shell_exec(convert $path $newPath), Then Image::make($newPath)and finally upload the image after converted it from the serve.
Codeigniter is not allowing uploading raw image files (CR2, NEF, DNG etc..) with following configuration.
I'm using dropzone.js to upload image/video files. On dragging the files to dropzone window, files get uploaded to temp folder and on submitting, they're moved to desired storage location.
I'm able to upload files with mime_types image/jpeg|image/png|image/gif|video/*. However, raw image files with extension .CR2!.DNG etc are not getting uploaded. It always throws the error You did not select a file to upload.
On analysing, I found that the default 'upload' library allows only jpeg|png|gif and other jpeg supported image formats.
$config['upload_path'] = './upload_files/temp/';
$config['allowed_types'] = 'jpeg|png|jpg|cr2|dng|srf|mp4|mov|mpg|mpeg|wmv|mkv';
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
$this->upload->initialize($config);
if (!$this->upload->do_upload('file')) {
$msg = $this->upload->display_errors('', '');
header("HTTP/1.1 404 Not Found");
return $msg;
} else {
....
}
Is updating upload library to allow required file types the only option OR are there other options exist?
Secondly, if the files are to be uploaded to different storage server viz., AWS S3 or others, is it always wise to upload to local temp folder and then push it to remote server?
TIA
Have a look at your mime type configuration file # config/mimes.php and add
'dng' => array('image/x-adobe-dng'),
'cr2' => array('image/x-dcraw', 'image/x-canon-cr2'),
you find a list of mime types for raw images here
update resuming comments:
RAW files are rather large files, so make sure the image-size is met in your php.ini settings: change post_max_size accordingly.
It works on php 7.2.20
I was trying to store image from dropbox url to my local folder with laravel Intervention , but with it i am getting errors after error.
Can anyone please tell me how can i do so ?
My code is this
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0';
$filename = explode('?',basename($path))[0];
Image::make($path)->save('images/'.$filename);
The error i am getting for this is
Unable to init from given binary data.
So i tried the solution from of of stackoverflow post
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0';
$filename = explode('?',basename($path))[0];
$path = base64_decode($path);
Image::make($path)->save('images/'.$filename);
But that gave me another error.
I tried looking on goggle but i didn't find any solid answer that works for my case
Can anyone please help me on this how to download image from dropbox url and save to loacal storage ? Or do i have to add dropbox api or something??
The dropbox link that you used https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0 is a image preview page, which is not a valid image content. You can use force download mode to fetch the image content from dropbox, by editing the query parameter from ?dl=0 to ?raw=1.
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?raw=1';
Image::make($path)->save('images/'.$filename);
See also: Force a file or folder to download, or to render on dropbox.com
I have a problem when using cloudinary in codeigniter. At first, i integrate the library by following answers from
Upload image to Cloudinary using PHP Codeigniter
It worked when i uploaded online image. But failed when i tried to upload local image. The error is
Error in loading http://localhost/admin-simple/assets/img/avatar1_small.jpg - 503 Service Unavailable
Here is my code :
Cloudinary::config(array( "cloud_name" => "my_cloud_name", "api_key" => "1234", "api_secret" => "ABCD" ));
$data['upload'] = \Cloudinary\Uploader::upload("http://localhost/admin-simple/assets/img/avatar1_small.jpg");
$this->load->view('partials/sukses_upload_gambar',$data);
Can anyone help me ? Because i've been stuck for hours. Thanks.
According to Cloudinary documentation, when uploading a file from your computer, you should specify the filepath instead of the URL of your local server:
\Cloudinary\Uploader::upload("/home/my_image.jpg")
http://cloudinary.com/documentation/php_integration
I run mediaelement on Firefox then Firefox throw error message below
"HTTP "Content-Type" of "video/mp3" is not supported. Load of media resource xxxxxx
Please Anyone help me resolve this problem.
Content-Type for mp3 is not video/mp3 it is audio/mpeg.You can refer to media types here
.
If you want to play a MP4 file then it must be video/mp4.You can check more media types for video here
You can refer here for media types supported by Firefox.