I'm trying to add single pixel into selectbox before text of each option.
I'm green-yellow colorblind, I made this only so you know what I would like to achieve(dont expect that colors will be accurate):
My html takes options out of foreach loop
<select name="selectbox" class="form-control">
<option value=""></option>
<? foreach ($this->color as $item): ?>
<option value="<?= $item ?>" <? if ($item == $this->model['item']): ?> selected<? endif ?> > <?= $item ?> </option>
<? endforeach ?>
</select>
which loops by controller function and returns view:
return $this->view //->assign('groups', $this->model->getGroups())
->assign('color', ['Text of Orange', 'Text of Red ', 'Text of Blue', 'Text of Yellow'])
->assign('something', $something)
To achieve that
I tried imagesetpixel
and imagepng
functions but it returns me boolean, and I dont know how could I possibly progress...
$gd = imagecreatetruecolor(1, 1);
$red = imagecolorallocate($gd, 255, 0, 0);
$canvas = imagesetpixel($gd, 1, 1, $red);
return $this->view
->assign('color', [imagepng($canvas) + 'Text of Orange', 'Text of Red ', 'Text of Blue', 'Text of Yellow'])
I made only 1 color, but I hope you got the idea of what I need.