• Resolved salave

    (@salave)


    Hello, our wordpress we removed the theme thumbnail code for custom images since already the logos are on set, we are aiming our users when they upload profile image, in our backend to not end up with many files for just single photo which is currently working because we only allowed 150*150 in media settings and we end up with only 2 files, the original (which most are big) and converted 150*150 that are small.

    The option were searching for today is if it can be possible when any image uploaded to be converted to not exceed 500kb size, including the original to go lower to that and not add extra files. Because if we continue growing one day we would end up with huge data, i want to take care of the future today. Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator bcworkz

    (@bcworkz)

    Max. upload file size could be managed in php.ini, but the limitation would be applied to all users. You’ll likely want admins to be able to upload larger on occasion? You can also limit upload size in WP through the ‘wp_handle_upload_prefilter‘ filter hook. You could limit size by user role if you wanted to. Your callback is passed an array of file data, including size. If too large for the situation, set the “error” array element to an error message and return the full array. WP will convert your message into a WP_Error object for you and display it to the user.

    N.B: the max. upload size shown in the media upload screen is based on the php.ini setting, not whatever limitation you impose in wp_handle_upload_prefilter. You can alter the size shown through the ‘plupload_init‘ filter.

    Moderator bcworkz

    (@bcworkz)

    The registration form appears to have been created with the help of a plugin. It uses a class name of “pmagic”. It likely has its own form edit area, or the form is edited through an editor widget. Try opening the page for editing. If you cannot edit it there, there should be something giving a clue about where else it might be edited. There could be an admin menu item regarding forms.

    Moderator bcworkz

    (@bcworkz)

    I don’t think the plugin code needs alteration, it’s in the registration page configuration where you need to be looking… I think. In the plugin’s starter guide, scroll down to the part about front-end registrations, then farther down there’s a section for profile fields. It’s likely there where you can configure form content.

    I don’t know much about this plugin other than what I just read in their guide. If you need further guidance on altering the form, I suggest contacting the plugin’s dedicated support channels.

    Thread Starter salave

    (@salave)

    Hi, back in admin panel, am presented with url that looks ( /wp-admin/admin.php?page=pm_upload_settings ), its upload page ( screenshot ) which when i change the bytes figure, it changes in registration form. So probably this text its in wp-admin folder

    Moderator bcworkz

    (@bcworkz)

    I found the text you’re looking for in the plugin’s files at /includes/class-profile-magic-custom-fields.php, line 683:
    __( 'Size Restrictions: Please make sure the image size is equal to or larger than %1$d by %2$d pixels and does not exceeds total size of %3$d bytes.','profilegrid-user-profiles-groups-and-communities' )

    I don’t recommend altering the source code because changes will be lost any time the plugin is updated. The __( part of the code means it’s a translatable string. This means you can use the “gettext” filter hook to alter the eventual text to anything you like, in any language. Be sure what ever you change it to still keeps the 3 integer references like %1$d. The lack of these would break the surrounding code.

    Thread Starter salave

    (@salave)

    We were able to update that text today thanks to your assistance after taking so many months to do so. Thanks!

    I also understand. Thanks for give brief details let me try it on my best cavity back irons site. Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Restricting image uploads’ is closed to new replies.