Hi,
1. I have 3 type content. Each type need one and one only image present.
2. If choose only one present... Not need display combobox on "Image details" screen.
3. "Image alignment" on "Image details" screen always first (align by left) by default. But need in admin settings add option for choose default value.

P.S. Sorry for my english.

Best Regards,
Sergei.

Comments

EugenMayer’s picture

Well i wont implement this. Please care about finding someone helping you out here or maybe implement it yourself and provide a patch?

Thank you.

(will close thise issue after 2 weeks without any happening)

EliteMonk’s picture

2. If choose only one preset... Not need display combobox on "Image details" screen.

File: wysiwyg_imageupload.form.inc
Method: function _wysiwyg_imageupload_details_form($img, $iid, $defaults = array())

Change

<?php
  // Imagecache preset
  $form['image_upload_details']['imagecache'] = array(
    '#type' => 'select',
    '#title' => t('Size'),
    '#default_value' => $defaults['imagecache'],
    '#options' => _wysiwyg_imagegupload_allowed_presets();
  );
?>

to

<?php
  // Imagecache preset
  $ic_options = _wysiwyg_imagegupload_allowed_presets();
  if (count($ic_options) == 1) {
    $form['image_upload_details']['imagecache'] = array(
      '#type' => 'hidden',
      '#value' => array_pop($ic_options),
    );
  } else {
    $form['image_upload_details']['imagecache'] = array(
      '#type' => 'select',
      '#title' => t('Size'),
      '#default_value' => $defaults['imagecache'],
      '#options' => $ic_options,
    );
  }
?>

Find new bug:
if uncheck all presets in admin settings, then image not display on page, but display on "Image details" screen.

EliteMonk’s picture

3. "Image alignment" on "Image details" screen always first (align by left) by default. But need in admin settings add option for choose default value.

File: wysiwyg_imageupload.module

Add method:

<?php
function _wysiwyg_imagegupload_align_options() {
  $m = drupal_get_path('module','wysiwyg_imageupload');
  return array(
    'imgupl_floating_left' => theme('image',"$m/images/left_float.png", $t = t('Image on left, text on right'), $t),
    'imgupl_floating_none' => theme('image',"$m/images/none_float.png", $t = t('Image is inline with the text (none)'), $t),
    'imgupl_floating_right' => theme('image',"$m/images/right_float.png", $t = t('Image on right, text on left'), $t),      
  );
}
?>

File: wysiwyg_imageupload.admin.inc
Method: wysiwyg_imageupload_admin_settings()

Add before return

<?php
$form['align']  = array(
    '#type' => 'fieldset',
    '#title' => t('Align'),
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
    '#weight' => -2,
  );
  $form['align']['wysiwyg_imageupload_align_by_default'] = array(
    '#type' => 'select',
    '#title' => t('Align by default'),
    '#description' => t('Align by default for new uploaded image.'),
    '#default_value' => variable_get('wysiwyg_imageupload_align_by_default', 0),
    '#options' => _wysiwyg_imagegupload_align_options(),
    '#after_build' => array('drupalwiki_imageselect_element_register'),
  );
?>

File: wysiwyg_imageupload.form.inc
Method: _wysiwyg_imageupload_details_form($img, $iid, $defaults = array())

Change

<?php
  // Alignment / Floating
  $m = drupal_get_path('module','wysiwyg_imageupload');
  $form['image_upload_details']['alignment'] = array(
    '#type' => 'select',
    '#title' => t('Image alignment'),
    '#options' => array(
      'imgupl_floating_left' => theme('image',"$m/images/left_float.png", $t = t('Image on left, text on right'), $t),
      'imgupl_floating_none' => theme('image',"$m/images/none_float.png", $t = t('Image is inline with the text (none)'), $t),
      'imgupl_floating_right' => theme('image',"$m/images/right_float.png", $t = t('Image on right, text on left'), $t),      
    ),
    '#default_value' => $defaults['alignment'],
    '#after_build' => array('drupalwiki_imageselect_element_register'),
  );
?>

to

<?php
  // Alignment / Floating
  $align_value = (isset($defaults['alignment']) && $defaults['alignment'] != '') ? $defaults['alignment'] : variable_get('wysiwyg_imageupload_align_by_default', '');
  $form['image_upload_details']['alignment'] = array(
    '#type' => 'select',
    '#title' => t('Image alignment'),
    '#options' => _wysiwyg_imagegupload_align_options(),
    '#default_value' => $align_value,
    '#after_build' => array('drupalwiki_imageselect_element_register'),
  );
?>
EugenMayer’s picture

you are mixing up 2 features, thats not good. Would be great if you can seperate them.

Are you aware on how to work with git?

EliteMonk’s picture

Sorry, i am learn only. Please, give me link about git.

EugenMayer’s picture

https://github.com/EugenMayer/wysiwyg_imageupload

thats our main repo there

A really good book is that one http://progit.org/

You would need to create a github account, make a fork of wui there and start a pull request. That would be awesome. create a branch for each feature and your really good to go!

EliteMonk’s picture

ty

EugenMayer’s picture

Status: Active » Needs work

would be cool to include this feature. What about a patch / pull reques Elite? All you other ideas already went in

EliteMonk’s picture

features 2 and 3 i commited to github, features 1 have bugs, and i think i commited later...