Support

Account

Home Forums Backend Issues (wp-admin) Expand Image field to allow mp4

Solving

Expand Image field to allow mp4

  • I am building a complex repeater layout

    I would normally have a select for media type; and conditionally display a image [acf:image] or video [acf:file/mime:mp4] input.

    However, as the setup is complicated I want to keep things simple for my user and just use a single image input (image input instead of file as it will show a thumbnail if an image is selected)

    I can then use the mime type to display either <video> or <image>. I do this with gallery inputs and it works well.

    However, I cannot find an obvious way to extend the image input to allow mp4 files as well as image files? Any ideas?

  • I resolved this by adding mp4 as a allowed filetype.
    You can then filter to show just MP4 as ACF allows you to search by MIME type in the open library windows

    The only code amend is to tweak the backend CSS so the box does not collapse to 30px-vs-30px

    add_action(‘admin_head’, ‘tweak_acf_custom_field_dimensions’);
    function tweak_acf_custom_field_dimensions() {
    echo ‘<style>
    [data-layout=”FIELDNAME”]
    .acf-image-uploader .image-wrap img {
    min-width: 150px;
    min-height: 150px;
    }
    </style>’;
    }

  • @tjhole-support I’m trying to do the same and was trying your solution, but while I am able to select an Mp4 in this way, after saving changes the field shows up as empty. Wondering how you were able to overcome this?

    Thanks,
    Tudor

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Expand Image field to allow mp4’ is closed to new replies.