• Hi,

    I need to prefill certain numbers to the crop aspect ratio form, so WP users don’t need to remember the ratio. Since this form has ID imgedit-crop-width-XXX and imgedit-crop-height-XXX I would use JavaScript, but the problem is the window is created using AJAX.

    How can I do that? Or is there any hook for that? Is it even possible without touching WP core?

    Thank!
    Filip

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you able to use the Media Image Size settings under the dashboard at yoursite.com/wp-admin/options-media.php ?

    Moderator bcworkz

    (@bcworkz)

    The AJAX action is “wp_ajax_image-editor” which calls wp_ajax_image_editor() and wp_image_editor(). There are no obvious hooks there, but the translation function _e() is called a lot. You might be able to use the related “gettext” filter to inject some javascript that fills in the fields. I’ve never tried this, there may be a security mechanism to prevent such things, but it might be worth a try.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to prefill crop image aspect ratio form in media’ is closed to new replies.