Tag Info

New answers tagged

0

My solution was to replace the following in image-rotation-repair.php $image = _rotate_image_resource( $image, $orientation ); with $rotated = imagerotate( $image, $orientation, 0 ); if ( is_resource( $rotated ) ) { imagedestroy( $image ); $image = $rotated; } Note: Usually, modifying a plugin's code is a bad solution, but in this particular ...


0

You can do this without a plugin in the newest versions of Wordpress. Go to Media, click on any image and then click on the edit image button. You can edit the image there and one of the options is rotation.


1

I updated PHP to 5.3.3-38 (el6) and that seemed to fix it for now.


1

Solved. What I did: Update wpml to latest version (3.1.8.2) On php.ini, change memory_limit to 128M Increase WP_MEMORY_LIMIT to 96M


1

I see that you have given the upload_max_filesize but you should also give post_max_size in your php.ini file.. post_max_size = 32M


0

First do a var_dump on the $_FILES variable to check if the array key you are using is the correct one, and you should never just grab a variable that comes from user input and just use it, try doing a isset or empty before you use the variable. After you found what is the key you will use wp_check_filetype because it will give safer data about the file, ...


0

@Tom J Nowell's answer is spot on. I found another alternative (using different functions) explained here but I like this one more. In my case I have an array of $posts with all the posts I want to insert and a separate $media (same $nid keys as $posts) with the media. My code is the same solution as Tom's but refactored to use an anonymous function: ...


0

Are you still able to access the setting to change the media uploads folder? I cloned a site and was able to see a long directory name on the Settings > Media page. I changed it to "wp-content/uploads" and saved - at which point the entry field was removed! It seems the feature was taken away in WP3.6m and now can onlt be changed in WP-config or in the ...


1

@Amirreza Nasiri - Yes that is possible. I have used following plugin to import large size files into WordPress Media library. Please take a look at this: https://wordpress.org/plugins/add-from-server/ I have no affiliation with plugin. I had used it for one of my client project and just found it as suitable suggestion for this question :)


0

I'm not sure whether its possible to download an external file directly to WordPress. But you can simply embed the video in your WordPress page without downloading it from the source. For that just click on 'Add media' button, then choose 'Insert from URL' and paste your video URL in the text box and finally click 'Insert into post'. This will embed the ...


1

Thanks to the tipoff from @birgire in the comment, I was able to locate two things, an example of an implementation that includes context, here (also of note is that the Github gist has code for the very useful ability to access any image uploaded from this context previously! https://gist.github.com/eduardozulian/4739075 /** * Example of inserting a ...


2

It doesn't. WP Filesystem API will ask for FTP credentials, but it will do so for each operation. They aren't stored persistently. They can be stored persistently by hardcoding into wp-config.php, but WP won't do that itself, it's a user action. Note that WP only asks for FTP credentials if it cannot modify files without them. If specific setup used to ask ...


0

Adding filter: add_filter( 'upload_dir', 'change_upload_dir', 10, 1 ); Function content: function change_upload_dir($param) { // Check for REFER $actual_page = $_SERVER['HTTP_REFERER']; parse_str( parse_url($actual_page, PHP_URL_QUERY), $query_array ); if ( strpos($actual_page, 'plugin_name.php') ) { ...


1

You can use this function as you mentioned and you need to learn your file extensions mime type (in example i add svg and xcf upload ability to wordpress) add_filter('upload_mimes', 'ability_to_upload'); function ability_to_upload($mimes = array()) { $mimes['svg'] = 'image/svg+xml'; $mimes['xcf'] = 'image/xcf'; return $mimes; } Here is a link ...


4

A workaround by extending the WP_Image_Editor_GD class The problem is how to access the image sizes before we change the quality of intermediate jpeg images. Note that the image_resize() function is deprecated. We can use the jpeg_quality filter from the public get_quality method of the abstract WP_Image_Editor class: $quality = apply_filters( ...


0

The settings itself are all fine. But the rights might be the problem. Change the rights recursively for wp-content to 777. This may raise security concerns and you have to take good care of who can access and write files to this directory. You may also have to change the rights for the folders wp-admin and wp-includes to 777. Note that is not recommended. ...


1

That message means that the php engine tried and failed to find a directory to which to temporarily store the uploaded file until l they are process by php scripts. Since it is happening before any script is being run it is very unlikely that you will be able to solve this by writing any php code. You might be able to change the php upload_tmp_dir setting ...


1

try to use get_temp_dir() to see if wordpress is using your WP_TEMP_DIR constant. i've tried this code in wp-config.php and it works define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/'); but you have to put it before the /* That's all, stop editing! Happy blogging. */ in your wp-config.php file.


0

If you pass true for the last $crop argument then so called "hard" crop mode is used. This will make WP produce results at exact size specified, except few edge cases (if image uploaded is smaller than specified size for example). Note that original image is still retained as it. If you need to actually modify originals as well — that is out of what WP ...


1

I stumbled upon the upload_mimes filter which can be used instead of wp_handle_upload_prefilter. For example: function custom_upload_mimes( $mimes ) { // Remove existing mime types. $mimes = array(); // Set desired mime types. $mimes['png'] = 'image/png'; $mimes['jpeg'] = 'image/jpeg'; $mimes['jpg'] = 'image/jpg'; $mimes['gif'] ...


0

Because you only have one slash instead of two in your URL: http:/eatdrink.ca That double slash ain't just for looks. :) Go to the hidden options.php page located at /wp-admin/options.php. Check and see what the "upload_url_path" is set to. Make sure it has a double slash there (if it's empty, that is acceptable as well, don't change it away from being ...


0

WP is reasonably secure for default use cases. In typical workflow it will call wp_check_filetype_and_ext() to verify that file uploaded is of allowed type. It can get considerably more questionable in regards to security if you customize it to work with non–default kinds of files and you might need to implement your own security checks. Note that users ...


0

I fixed it by just removing the function that threw the error. I have not seen any implications yet. Image upload is working perfectly now.


0

You shouldn't have to reload anything you will need to hook this fucntion into a hook so it's actually run something like this should do it: do_action( 'init', 'toolbox_setup' ); http://codex.wordpress.org/Function_Reference/do_action


2

Absolutely, you can simply hook into upload_size_limit and set a maximum filesize: // Change the upload size to 1MB add_filter( 'upload_size_limit', 'wpse_163236_change_upload_size' ); function wpse_163236_change_upload_size() { return 1000 * 1024; }


0

No there isn't a way to reduce the file size without access to php.ini or .htaccess for the reason your quote explains very well. The best you can do without access to php.ini is to ignore the file as lalocin's answer shows


0

You can restrict the file size via the wp_handle_upload_prefilter, where The single parameter, $file, represent a single element of the $_FILES array. The code below is just exemplary, but you'll get the point. add_filter( 'wp_handle_upload_prefilter', 'wpse163236_restrict_upload_file_size' ); function wpse163236_restrict_upload_file_size( ...


-5

you can add to functions: @ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );



Top 50 recent answers are included