Resize image in codeigniter - codeigniter

I want to resize an image while displaying it on form (100 * 100) in CodeIgniter, by using this function:
echo img('imagepath');

This will do it..
$image_properties = array(
'src' => 'imagepath',
'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
'class' => 'post_images',
'width' => '100',
'height' => '100',
'title' => 'That was quite a night'
);
echo img($image_properties);
Source: Codeigniter

Related

Sort by custom field (acf) date picker and publish date

I would like to sort posts using firstly the custom field date picker by ACF plugin for wordpress, and then when that's non existing, by the published date.
Our theme works with cases so I cooked up something like this but I failed misearbly, any suggestions ?
case 'concertdatum':
$wp_query_args['meta_query'] = array(
'relation' => 'AND',
'datum_clause' => array(
'meta_key' => 'datum',
'meta_type' => 'DATETIME'
),
'publish_clause' => array(
'column' => 'post_date_gmt',
'compare' => 'EXISTS',
),
)
$wp_query_args['order'] = array(
'datum_clause' => 'DESC',
'publish_clause' => 'DESC'
);
break;

how to get multidimantional array in laravel

array(
'id' => 1,
'title' =>'BlackBerry Leather Smart Flip Case for BlackBerry PRIV',
'product_type' => 'Mobile',
'product_image' => array(
0 => array(
'product_id' => 1,
'image_src'=> 'https://22198_grande.jpg',
'variant_ids' => 11
)
),
'product_variant' => array(
0 => array(
'product_id' => 1,
'image_id' => 21,
'title' => "BlackBerry Leather Smart Flip Case for BlackBerry PRIV/black",
'price' => 250
)
)
);
I want to change this array to associative array format
id=>1;
title=>BlackBerry Leather Smart Flip Case for BlackBerry PRIV;
product_type=>Mobile;
product_id=>1;
image_src=>https://22198_grande.jpg;
variant_ids=>11;
product_id=>1;
image_id=>21;
title=>BlackBerry Leather Smart Flip Case for BlackBerry PRIV/black;
price=>250
Use laravel map function for this
$multiplied = $schoolkids->map(function ($kids) {
$test = $kids;
$temp = collect($kids->toArray());
return $temp->except(['id','class_id','org_id','section_id','parent_id', 'parent_info', 'class_name', 'classes', 'org_detail'])->merge($kids->orgDetail->toArray())->merge($kids->parentInfo->toArray())->merge($kids->classes->toArray());
});
$multiplied is the main query Kids is the first array function and if you want to remove some ids from array than use except function

How to add the alt and title fields in an image field of a custom entity in drupal 8

I created a custom entity with an image field. But I can not display the alt and title fields.
Here is my code:
$fields['main_img'] = BaseFieldDefinition::create('image')
->setLabel(t('Main image of the hardware'))
->setSettings([
'file_directory' => 'hardware',
'file_extensions' => 'png jpg jpeg',
])
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'image',
'weight' => -30,
))
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
Could you tell me how to display the alt and title fields of my image and maybe someone knows where the documentation is for doing that because I can not find it?
Thank you all
I loaded one of my node field definitions with $node->getFieldDefinitions():
I believe you can try something like this:
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
'settings' => [
'alt_field' => TRUE,
'alt_field_required' => TRUE, //optional
'title_field' => TRUE,
'title_field_required' => TRUE, //optional
],
))
Thank Dmytro.
I feel a little stupid but it's life.
It was enough to add 'alt_field_required' => FALSE and 'title_field' => TRUE in setSettings.
But as title and alt is displayed that when we download an image I thought it did not work.
A day of lost!

How to add elements to a fieldset in magento horizontally rather than vertically

I am adding few check boxes in to magento using the fieldset option like the following.
$fieldset = $form->addFieldset('display', array(
'legend' => $helper->__('Schedule Sales Order Transfer'),
'class' => 'fieldset-wide'
));
for($i=01; $i*5<60; $i++){
$time = $i*5;
$fieldset->addField('min'.$time, 'checkbox', array(
'name' => 'Checkbox',
'checked' => false,
'onclick' => self::setAll("min"),
'onchange' => "",
'value' => ''.$time,
'disabled' => false,
'after_element_html' => '<small>'.$time.'</small>',
'tabindex' => 1
));
}
By doing so, all the check boxes are coming one below another. Is it possible to make it one adjacent to another i.e., horizontally?
Anybody Please suggest the solution ASAP...
Thank you,
In your Code return like <tr>...</tr><tr>..</tr>, so if you need to add custom css or js to achieve what you expected,
or
for($i=01; $i*5<60; $i++){
$time[$i]['value'] = $i*5;
$time[$i]['label'] = $i*5;
}
$fieldset->addField('Time', 'checkboxes', array(
'label' => $this->__('Time'),
'name' => 'time[]',
'values' => $time,
'value' => '1',
'tabindex' => 1
));
its return like <tr><td>label</td><td>value<ul><li></li>....<li></li></ul></td></tr>
then you continue your stuff.,
Note: I'm just suggest the possible ways

Magento Reviews Management - Edit Grid

In magento admin I can only see up to 50 characters of review text. How can I edit template etc so I can view the whole review text?
Thanks
you need to override the _prepareColumns() function under Mage_Adminhtml_Block_Review_Grid
there is below code section
$this->addColumn('detail', array(
'header' => Mage::helper('review')->__('Review'),
'align' => 'left',
'index' => 'detail',
'filter_index' => 'rdt.detail',
'type' => 'text',
'truncate' => 50,
'nl2br' => true,
'escape' => true,
));
in which truncate is used, you need to increase the limit.

Resources