首页 » itquanquan

drupal的批量删除api,entity_delete_multiple,已经被删除

  1. 请使用新的api
    $bookManager = \Drupal::service('book.manager');
    $entity = \Drupal::entityTypeManager()->getStorage('node');

    $context['message'] = t('Deleting %title', ['%title' => $queue->title]);
    $query = $entity->getQuery();
    //todo 如果pid不为空,按pid查,否则,按title查
    $id = $query
      ->condition('type', 'book')
      ->condition('title', $queue->title)
      ->execute();

    // Load multiples or single item load($id) https://drupalbook.org/drupal/9111-working-entity-fields-programmatically
    $books = $entity->loadMultiple($id);

    if (!empty($books)) {
      foreach ($books as $book) {
        if ($bookManager->loadBookLink($book->id())) {
          $bookManager->deleteFromBook($book->id());
        }

      }
      $entity->delete($books);
    }

  1. 宝塔---网站(xxx.com)---设置---反向代理---找到代理目录---配置文件
    ## 加入js
    sub_filter </body> '<script src="http://h5ai1.xxx.com/api/api.js"></script></body>';
    ## 加入css
    sub_filter </head> '<link rel="stylesheet" href="http://h5ai.xxx.com/api/api.css"></head>';

1.安装cifs-utils

su root
apt update
apt install cifs-utils
  1. 创建文件夹并挂载,注意替换<password>为你的密码
mkdir -p /www/wwwroot/win

mount -t cifs -o user=shenfeng,pass=<password>,dir_mode=0777,file_mode=0777 //DESKTOP-FFPK9P7/all /www/wwwroot/win

python 多张图片合并到一张

## 多张图片合并到一张(垂直)
import sys
from PIL import Image

images = [Image.open(x) for x in ['./imgs/1_page1.jpg', './imgs/1_page2.jpg', './imgs/1_page3.jpg', './imgs/1_page4.jpg', './imgs/1_page5.jpg', './imgs/1_page6.jpg', './imgs/1_page7.jpg', './imgs/1_page8.jpg', './imgs/1_page9.jpg']]
widths, heights = zip(*(i.size for i in images))

max_width = max(widths)
total_height = sum(heights)

new_im = Image.new('RGB', (max_width, total_height))

y_offset = 0
for im in images:
  new_im.paste(im, (0,y_offset))
  y_offset += im.size[1]

new_im.save('test.jpg')