自己用C++写的NextGEN Gallery批量添加照片html代码生成器

less than 1 minute read

wordpress的图片功能太弱,NextGEN Gallery插件很强大,可是也不能批量插入图片
要一下次插入个20来张图片鼠标也点累死了
先上传图片NextGEN Gallery图集,缓冲完缩略图
in.txt文件第一行为新添加的图集绝对路径,此后每行为文件名
out.txt输出html代码(居中,缩略图)
接下来就是复制粘贴啦
c++代码如下:

#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
string path,image;
ofstream fout;
ifstream fin;
fout.open("output.txt");
fin.open("in.txt");
fin >> path;
while (fin >> image){
fout &lt;&lt; "<a href="&quot;&lt;br &gt;&lt;/a&gt;          &lt;&lt; path &lt;&lt; image&lt;br /&gt;          &lt;&lt; &quot;"><img src="&quot;&lt;br /&gt;          &lt;&lt; path &lt;&lt; &quot;thumbs/thumbs_&quot;&lt;br /&gt;          &lt;&lt; image&lt;br /&gt;          &lt;&lt; &quot;" alt="                               " />
&lt;&lt; " class='ngg-singlepic ngg-center' /&gt;</a>"
&lt;&lt; endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}