- 新增阿里云OSS SDK核心类库文件 - 新增OSS插件配置文件及钩子监听 - 新增分类图标SVG资源并优化为轻量化格式 - 替换定位接口为天地图逆地理编码接口 - 新增OSS图片缩略处理工具方法
57 行
3.4 KiB
PHP
57 行
3.4 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
/** 导出分类 → prompt 映射,供 MCP GenerateImage 批量生成使用 */
|
|
$my = 'D:\Softwares\phpstudy_pro\Extensions\MySQL5.7.26\bin\mysql.exe';
|
|
$pdo = new PDO("mysql:host=127.0.0.1;port=3307;dbname=fenleixinxi;charset=utf8mb4", 'fenleixinxi', 'fenleixinxi');
|
|
$rows = $pdo->query("SELECT id,pid,name,kind FROM fa_fc_category WHERE enabled=1 ORDER BY pid,sort,id")->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$mapJson = file_get_contents(__DIR__ . '/map.json');
|
|
$map = json_decode($mapJson, true);
|
|
|
|
$NO_TEXT = ", no text, no watermark, no logo, no signature, no artist tag, no caption, no brand mark, no AI generated label, no corner badge, no copyright mark, no overlay text";
|
|
|
|
function vegeEn($name, $map) {
|
|
foreach ($map['vege_en_hint'] as $k => $v) if ($k === $name) return $v;
|
|
return $name;
|
|
}
|
|
|
|
$items = [];
|
|
foreach ($rows as $r) {
|
|
if ($r['pid'] == 0) continue;
|
|
$id = $r['id']; $name = $r['name']; $kind = $r['kind'];
|
|
$outPath = 'D:/Softwares/phpstudy_pro/WWW/fenleixinxi/tmp_img/downloaded/' . $id . '.jpg';
|
|
|
|
if ($kind === 'farm') {
|
|
$en = vegeEn($name, $map);
|
|
$prompt = "a bamboo basket full of fresh $en, placed on the soil of a $en farm or orchard field, background with rows of naturally growing $en plants or trees, natural daylight, bright fresh mint green mood, realistic photography style, close-up composition, 1:1 square$NO_TEXT";
|
|
} else {
|
|
$live = null;
|
|
foreach ($map['live_animal_map'] as $k => $v) if ($k === $name) { $live = $v; break; }
|
|
if ($live) {
|
|
$prompt = "a herd of $live grazing or standing naturally on a green grass pasture or farmhouse courtyard, background with distant hills and blue sky, natural daylight, bright fresh mint green mood, realistic photography style, wide shot, 1:1 square composition$NO_TEXT";
|
|
} elseif (in_array($name, $map['egg_list'])) {
|
|
$en = vegeEn($name, $map);
|
|
$prompt = "a bamboo basket full of fresh $en with some green plants and straw decoration, placed on a rustic wooden table in a sunny farmhouse courtyard, natural daylight, warm pastoral mood with fresh mint green undertone, realistic photography, 1:1 square$NO_TEXT";
|
|
} elseif (in_array($name, $map['water_list'])) {
|
|
$prompt = "a natural fish pond with various live fish swimming in clear blue water, surrounded by green grass and reed, natural daylight, fresh mint green mood, realistic photography, 1:1 square composition$NO_TEXT";
|
|
} elseif (in_array($name, $map['processed_list'])) {
|
|
$en = vegeEn($name, $map);
|
|
$prompt = "fresh $en arranged nicely on a rustic wooden table, background with farmhouse kitchen or market stall setting, natural daylight, fresh mint green mood, realistic photography style, close-up, 1:1 square$NO_TEXT";
|
|
} else {
|
|
$en = vegeEn($name, $map);
|
|
$prompt = "a bamboo basket full of fresh $en, placed on the soil of a $en farm or orchard field, background with rows of naturally growing $en plants or trees, natural daylight, bright fresh mint green mood, realistic photography style, close-up composition, 1:1 square$NO_TEXT";
|
|
}
|
|
}
|
|
|
|
$items[] = [
|
|
'id' => $id,
|
|
'name' => $name,
|
|
'kind' => $kind,
|
|
'path' => $outPath,
|
|
'prompt' => $prompt,
|
|
];
|
|
}
|
|
|
|
file_put_contents(__DIR__ . '/prompt_map.json', json_encode($items, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
|
|
echo "exported " . count($items) . " prompts\n";
|