Setting options in phpwkhtmltoimage - wkhtmltopdf

I am trying to reduce the file size of images outputted from phpwkhtmltoimage (php wrapper for wkhtmltopdf)
The image is being saved fine, but the image outputted is exactly the same as having no options set. I am guessing that I am doing something wrong here.
$options = array(
'--dpi 300',
'no-outline',
'--image-quality 10',);
$image = new Image('http://bl.ocks.org/mbostock/raw/7555321/', $options);
$image->saveAs('output.png');
Cheers

Try setting the options like this:
$options = [
'dpi' => 300,
'no-outline' => true,
'image-quality' => 10
];

Turns out there is no dpi setting for phpwkhtmltoimage nor image-quality. Instead it uses quality.
array('quality' => 20);

Related

How can I change the background color of columns in Laravel-admin?

I'm currently working on Laravel-admin project with laravel9.
For instance, If the value = 'error', I want to change the background color of the column.
Something like this pic:
My code is this:
$grid->column('title')->display(function ($title, $column) {
if ($title !== 'error') {
return $title;
}
return $column->setAttributes(['style' => 'background-color:red;']);
});
But seems like I can't use setAttributes() method on $column.
Also If I use setAttributes(['style' => 'background-color:red;']) the column name(In this case title) become red as well.
Any advice would be appreciated.
I read the Laravel-admin document and searched for a solution for hours but I couldn't find any good info.

SilverStripe 3.4 Custom Reports - Set filenames as links in custom report to allow for easy editing

I'm new to SilverStripe reports but I haven't been able to find anything related to this particular issue so far.
I have a custom report that lists all images and files on the site in a gridview, however, I would like to make it so that people can either click on the filename and go to the image or file to edit it, or have an edit button for each image and file. Right now, if anyone wants to edit a file or image, they have to leave the report, go the Files tab, search for said file/image, and click to edit. That's rather tedious.
I know there is a way to make page titles clickable in reports based on the existing report examples in cms/code/reports. But I don't see anything that relates to linking to uploaded images and files.
Is there is a way to do this?
Here is the code for my custom report:
<?php
class CustomSideReport_ListofImagesAndFiles extends SS_Report {
// the name of the report
public function title() {
return 'All Images and Files';
}
// what we want the report to return
public function sourceRecords($params = null)
{
return File::get()
->sort('Title');
}
// which fields on that object we want to show
public function columns() {
return array(
"Title" => 'Image Title',
'Filename' => array(
"Filename" => "Filename",
"link" => true,
),
);
}
}
using "link" => true doesn't work -- it tries to create a page link, which isn't right. I've tried "edit" and "CanEdit."
Ok, I came up with this from referencing the setup for the Broken Links report:
// which fields on that object we want to show
public function columns()
{
$linkBase = singleton('CMSFileAddController')->Link('EditForm/field/File/item');
$linkBaseEditLink = str_replace("/add","",$linkBase);
$fields = array(
'Title' => 'Title',
'AbsoluteLink' => array(
'title' => _t('CustomSideReport_ListofImagesAndFiles.ColumnFilename', 'Filename'),
'formatting' => function($value, $item) use ($linkBaseEditLink) {
return sprintf('%s',
Controller::join_links($linkBaseEditLink, $item->ID."/edit"),
strstr($value, '/assets/', false)
);
}
)
);
return $fields;
}
I don't know if this is the best solution ever--it works, and I can't find anything else that relates to this kind of report creation for SilverStripe (everything I've found deals with getting Pages for reports, not images or files.
I had to make some tweaks because there is no CMSFileEditController like there is a CMSPageEditController, but I made due with what I had.
If anyone has a better solution then by all means, please share!

BG Colour menu does not seem to appear once full toolbar is configured on TestLink 1.9.16

CKeditor version 4.6
Browser : Firefox.54
OS :Linux 3.13.0-36-generic
I tried to configure the cfkeditor within the testlink tool and provided the configurations as below in order to get the full toolbar. However, I cannot seem to get the BGColor menu option.
steps
1.configure the cfg/tl_ckeditor_config.js as shown below 1
2.call the menu name Full within the config.ini.php as below[2]
Note: How can I obtain the BGColor menu button.
1 cfg/tl_ckeditor_config.js
config.toolbar_Full =
[
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['BidiLtr', 'BidiRtl' ],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize','ShowBlocks','-','About']
];
[2] config.ini.php
`
$tlCfg->gui->text_editor['steps_design'] = array('type' => 'ckeditor','toolbar' => 'Full',
'configFile' => 'cfg/tl_ckeditor_config.js',
'height' => 50);
$tlCfg->gui->text_editor['execution'] = array( 'type' => 'none');
$tlCfg->gui->text_editor['edit_execution'] = array( 'type' => 'none', 'cols' => 80, 'rows' => 20);
$tlCfg->gui->text_editor['display_execution_notes'] = array('type' => 'none', 'cols' => 80, 'rows' => 20);
`
According to ckeditor's documentation, additional optional plugins are needed to support the BG Color feature.
On the same page, relative to those two items, they also say: (bold emphasis mine)
The Text and Background Color feature does not create semantically
meaningful content. Even if you adjust the color list to match the
style of your website, your users will be able to arbitrarily apply
colors to text elements without any consistency.
A much better idea for creating semantic content and maintaining
consistent styling across your website is to adjust the Styles
drop-down list to include some colors that could be applied to
user-created content and would still be consistent with your website
design.
Probably not what you want to hear, but now you know.

Return unknown output from glide-laravel

Im using league/glide-laravel package
and use below code to make resize image
Route::get( '/showImage/{w}/{h}/{src}',function( League\Glide\Server $server,$w,$h, $src ){
$server->outputImage( $src, [ 'w' => $w, 'h' => $h ]);
})->where( 'src', '.+');
but gets this result
The function outputImage does not add any content-type headers to the request, so you browser does not know what to do with the data and just shows it as plain text.
It is recommended to use the function getImageResponse as this creates an actual response object with the correct headers needed to display this image in the browser.

Setting custom toolbarset of FCKeditor in CodeIgniter

I really need Ur help here
I’m using fckEditor 2.6.5 with CI 1.7.2
I used this steps to pluged it into my project : http://codeigniter.com/forums/viewthread/107642/
I want to ask, how to set custom toolbarset in fckeditor???
some of articles said to doing that is by editing fckconfig.js with adding new custom toolbarset over there, than we can call it when we need. it’s about like this :
//fckconfig.js.
//add this sample codes..
FCKConfig.ToolbarSets["Custom"] = [
['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-']
],['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'] ;
then we call in controller
$fckeditorConfig = array(
'instanceName' => 'message',
'BasePath' => base_url().'system/plugins/fckeditor/',
'ToolbarSet' => 'Custom', //here we go
'Width' => '100%',
'Height' => '400',
'Value' => ''
);
$this->load->library('fckeditor', $fckeditorConfig);
but when I load the page, its warned there, that no Custom toolbarset exists.
how to make it???
even, when I tried to only change the option of Default Toolbarset (by removing some options toolbar), not adding custom toolbarset in fckeditor, there is no effect on my page. it still completely show the default toolbar (full toolbar)
It's probably just cache. FCKEditor is heavy with cache and I've seen the same thing first-hand.
Your code looks correct.

Resources