add grepper answer manually
// If the "add answer" button isn't showing:
// Simply press "a" on your keyboard after searching your question! :)
add grepper answer manually
// If the "add answer" button isn't showing:
// Simply press "a" on your keyboard after searching your question! :)
how to make a grepper answer
Hello here is me making a random grepper answer:
how to add answer to grepper
// how to find out which shell is running.
ps -p $$ – Display your current shell name reliably
echo "$SHELL" – Print the shell for the current user but not necessarily the shell that is running at the movement.
echo $0 – Another reliable and simple method to get the current shell interpreter name on Linux or Unix-like systems.
readlink /proc/$$/exe – Another option to get the current shell name reliably on Linux operating systems.
cat /etc/shells – List pathnames of valid login shells currently installed
grep "^$USER" /etc/passwd – Print the default shell name. The default shell runs when you open a terminal window.
chsh -s /bin/ksh – Change the shell used from /bin/bash (default) to /bin/ksh for your account
how to add answer to grepper
Install / Uninstall gimp:
For Ubuntu 18.04, this PPA contains the most recent FFmpeg
libraries copied from Jonathon F's PPA.
https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-4
To install, run command:
sudo add-apt-repository ppa:ubuntuhandbook1/gimp
sudo apt update
sudo apt install gimp
To uninstall, run commands:
sudo apt install ppa-purge
sudo ppa-purge ppa:ubuntuhandbook1/gimp
grepper add code answer
Cakephp 3 image upload with thumbnail and resize image
check Tables if its AllowEmptyString or AllowEmptyFile
check Form Control Create Type File is it exist?
if (!empty($this->request->data['id_front_side']['name'])) {
$fileName = $this->request->data['id_front_side']['name']; //put the data into a var for easy use
$id_front_side = $fileName;
$extm = substr(strtolower(strrchr($fileName, '.')), 1); //get the extension
$arr_extm = array('jpg', 'jpeg', 'gif', 'png'); //set allowed extensions
if (in_array($extm, $arr_extm)) {
$uploadPath = WWW_ROOT . DS . 'images' . DS . 'organisations' . DS . $id . DS . 'media'. DS;
$uploadFile = $uploadPath . $fileName;
if(!is_dir($uploadPath)) {
mkdir($uploadPath);
}
$auto = $this->generateRandomString(6);
//$files_image='product_'.$auto.'_'.$image_id.'_'.$images['name'];
$files_image = 'product_' . $auto . '_' . $id . '_' . $fileName;
$test = $uploadPath. $files_image;
// move_uploaded_file($this->request->data['id_front_side']['tmp_name'], $uploadFile);
move_uploaded_file($this->request->data['id_front_side']['tmp_name'], $test );
$this->request->data['id_front_side'] = $test;
$source_image = $test;
$destination_thumb_path = $uploadPath. DS . 'small' . DS . $files_image;
$destination_thumb_path1 = $uploadPath . DS . 'large' . DS . $files_image;
// $directory = new Folder();
$this->imageresize2($source_image, $destination_thumb_path, 270, 320, 1);
$this->imageresize2($source_image, $destination_thumb_path1, 500, 500, 1);
}
}
////////////////////////////////////////
public function imageresize2($src, $dst, $width, $height, $crop = 0)
{
if (!list($w, $h) = getimagesize($src)) return "Unsupported picture type!";
$type = strtolower(substr(strrchr($src, "."), 1));
if ($type == 'jpeg') $type = 'jpg';
switch ($type) {
case 'bmp':
$img = imagecreatefromwbmp($src);
break;
case 'gif':
$img = imagecreatefromgif($src);
break;
case 'jpg':
$img = imagecreatefromjpeg($src);
break;
case 'png':
$img = imagecreatefrompng($src);
break;
default:
return "Unsupported picture type!";
}
// resize
if ($crop) {
if ($w < $width or $h < $height) return false;
$ratio = max($width / $w, $height / $h);
$h = $height / $ratio;
$x = ($w - $width / $ratio) / 2;
$w = $width / $ratio;
} else {
if ($w < $width and $h < $height) return false;
$ratio = min($width / $w, $height / $h);
$width = $w * $ratio;
$height = $h * $ratio;
$x = 0;
}
$new = imagecreatetruecolor($width, $height);
// preserve transparency
if ($type == "gif" or $type == "png") {
imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
imagealphablending($new, false);
imagesavealpha($new, true);
}
imagecopyresampled($new, $img, 0, 0, $x, 0, $width, $height, $w, $h);
switch ($type) {
case 'bmp':
imagewbmp($new, $dst);
break;
case 'gif':
imagegif($new, $dst);
break;
case 'jpg':
imagejpeg($new, $dst);
break;
case 'png':
imagepng($new, $dst);
break;
}
return true;
}
public function generateRandomString($length = null)
{
return substr(str_shuffle(str_repeat($x = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length / strlen($x)))), 1, $length);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us