C
C
coderlex2016-07-14 19:56:42
PHP
coderlex, 2016-07-14 19:56:42

How to connect typings?

What I did:
1. Put typings.json in the root of the project
2. Run $ typeings install in the console
3. A typings directory appeared with index.d.ts inside
What's next? How can I make the compiler and Visual Studio Code see these declarations?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
riot26, 2016-01-31
@riot26

Why duplicate? Output another change in php on top of the image?

V
Vitaly Vitaly, 2016-01-31
@V_Tjuryakin

I duplicated what you need, then I think change it yourself as you need

<?php 
function writeTextOnImage($filename, $text, $text2)  
{   
    $size_img = getimagesize($filename);  
    if ($size_img[2]==2)       $src_img = imagecreatefromjpeg($filename);  
    else if ($size_img[2]==1)  $src_img = imagecreatefromgif($filename);  
    else if ($size_img[2]==3)  $src_img = imagecreatefrompng($filename);    
    // устанавливаем цвет нашей надписи и прозрачность (тут он будет синий и полностью прозрачный)
    $color = imagecolorallocatealpha($src_img, 255, 255, 255, 0);  
    $font_file = "font.ttf";  // шрифт, которым пишем надпись (будьте внимательны с путем к шрифту)
    $img_x = imagesx($src_img); 
    $img_y = imagesy($src_img);     
    $height_font = 30; // размер шрифта 
    $angle = 0;  // наклон надписи
  $iddmg = $_GET['idd'];
     
    // Запись текста поверх изображения  
    imagettftext($src_img, $height_font, $angle, $img_x - 670, $img_y - 300, $color, $font_file, $text); 
    imagettftext($src_img, $height_font, $angle, $img_x - 570, $img_y - 200, $color, $font_file, $text2); 

    // Вывод изображения в браузер  
    if ($size_img[2]==2)  
    {  
        header ("Content-type: image/jpeg");  
        imagejpeg($src_img, 'images/'.$iddmg.'.jpg');
        imagejpeg($src_img);		
    }  
    else if ($size_img[2]==1)  
    {  
        header ("Content-type: image/gif");  
        imagegif($src_img);  
    }  
    else if ($size_img[2]==3)  
    {  
        header ("Content-type: image/png");  
        imagepng($src_img);
        imagejpeg($src_img, 'images/'.$iddmg.'.png');		
    }  
    return true;  
} 
// использование 
$name = $_GET['name'];
$name2 = $_GET['name2'];
$ran_dom = rand (1 , 17);
$img = "img/".$ran_dom.".png"; // путь к изображению
writeTextOnImage($img, $name, $name2);  // тут "тект" - это наш текст, который будет поверх картинки
?>

B
bromzh, 2016-07-14
@coderlex

If tsconfig is correct, then nothing else is required. By default, the compiler will include and compile all .ts and .d.ts files into the project recursively, starting from the folder where tsconfig.json is located, usually this is the project root. The only important point: so that the compiler does not start searching and compiling everything from the node_modules folder, it must be added to the list of excluded directories.
Here is an example config:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true
  },
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "buildOnSave": false
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question