On Tuesday 26 April 2011 09:31:22 Tim Serong wrote:
On 4/26/2011 at 06:12 PM, Peter Nikolic <p.nikolic1@btinternet.com> wrote:
Right the this is a fun one involving web pages
i use a page of basically the following line <a class="thumbnail" href="#thumb"><img src="stagepics/car4-0.jpg" width="100px"
height="75px" border="0" /><span><img src="stagepics/car4-0.jpg" /><br /></span></a>
to display a gallery of images from one of our recent rallys but i have somethingh like another 300 photos yet to go on lots of typing can someone point me in the direction of scripting this to automatically read the dir with the pictures in and fill in a line as above for each picture
Pete .
From a terminal, in the directory above "stagepics", try something like:
for f in stagepics/*jpg ; do echo \ "<a class=\"thumbnail\">...<img src=\"$f\" width=\"100px\" />...</a>" ; done > pics.html
You can put that all on one line, but it should work split over three as above. Insert the other HTML you need where the "..." bits are. Just watch the quoting - all the double quotes in the HTML need to be escaped as \". Also, the above will create/overwrite "pics.html", make sure nothing with that name already exists :)
HTH,
Tim Hi Tim
Right think it is close but not being a bash wiz i am getting an error that does not make sense to me i have for f in stagepics/*jpg ; do echo \"<a class=\"thumbnail\" href=\"#thumb\"><img src=\"$f\" width=\"100px\" height=\"75px\" border=\"0\"><span><img src=\"$f\"></span></a>\" ; done > pics.html when i run it i get syntax error near unexpected token `<' and i be jiggered if i can find the problem .. Pete . -- Powered by openSUSE 11.3 (x86_64) Kernel: 2.6.34.7-0.7-desktop KDE Development Platform: 4.6.00 (4.6.0) 11:34 up 3 days 1:31, 5 users, load average: 1.00, 0.88, 0.48 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org