Media and all images disappeared from my wordpress site

Go into your document root, then locate your media folder (default wp-include/media) and raw files (jpgs etc) should be there. If not, check your trash bin, if not, your hosting provider is your last resort. Edit: after this, download all your files as backup into your local machine, including media and settings etc and reinstall … Read more

MP4 file links download instead of playing

I suggest you to make updates on your web-server instead of WordPress. You can set mime type for mp4 files to application/octet-stream. Using .htaccess (Apache): AddType application/octet-stream .mp4 For nginx check documentation If you need to change mp4 mime type on upload, you can use this hook: add_filter(‘upload_mimes’, ‘wpse_320375_remove_mime_types’); function wpse_320375_remove_mime_types($mimes){ $mimes[‘mp4’] = ‘application/octet-stream’; }

Handle image file and save it to media

What I did was to get media folder and save there the cropped image. After that update meta data: $imageToCropPath= get_attached_file($attachmentId); // Get file path to the image that will be cropped $img = imageCreateFromJpeg($imageToCropPath); $croppedImage = imagecrop($img, [‘x’ => $cropX, ‘y’ => $cropY, ‘width’ => $cropWidth, ‘height’ => $cropHeight]); $uniqueId = md5(uniqid()); // Create … Read more

How to Protect Uploads, if User is not Logged In?

Only checking if the cookie exists, is not much of a strict protection. To get a stronger protection, you can pass or “proxy” all requests to the uploaded folder (exemplary uploads in the following example) through a php script: RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L] All requests to uploaded files (which includes images in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)