Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Image picker , brake after setting

Open danyj opened this issue 10 years ago • 2 comments

Can we have image-picker brake after setting to drop images on second line Currently the width is at auto https://github.com/ThemeFuse/Unyson/blob/master/framework/includes/option-types/image-picker/class-fw-option-type-image-picker.php#L202

and it just keeps on adding images in one row making it look out of line with the rest of the options

screenshot_15

I know I can CSS it but it would be just easier to do

    'type' => 'image-picker',
    'brakeafter' => 3,

or something similar that would brake after every 3rd ( option dependent ) image

danyj avatar Sep 23 '16 15:09 danyj

Target the option with a class:

        'type' => 'image-picker',
        'attr' => array( 'class' => 'narrow' ),

Enqueue css in admin, to limit the sizes so that new rows will be formed:

    .fw-backend-option-type-image-picker.narrow .thumbnails {
        max-width: 350px;
    }
    .fw-backend-option-type-image-picker.narrow .thumbnail img {
        max-width: 100px;
    }

Set the size of image if css isn't enough:

        'choices' => array(
            'value-1' => array(
                'small' => array(
                    'src' => get_template_directory_uri() .'/images/thumbnail.png',
                    'height' => 100 // pixels
                    'width' => 100 // pixels
                ),
            )
        ),

albertso avatar Oct 21 '16 01:10 albertso

I think this is a very specific need, that can be very easy implemented with some custom CSS:

'picker' => array(
	'type'    => 'image-picker',
	'value'   => array(),
	'label'   => __( 'Pick', 'fw' ),
	'attr'    => array(
		'class' => 'break-3'
	),
	'choices' => array(
		'1' => 'ICON URL',
		'2' => 'ICON URL',
		'3' => 'ICON URL',
		'4' => 'ICON URL',
		'5' => 'ICON URL',
	)
),

and the CSS part:

.fw-option-type-image-picker.break-3 ul.thumbnails>li:nth-child(4) {
    clear: left;
}

GheorgheP avatar Mar 06 '17 14:03 GheorgheP