Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-23-2013, 01:18 AM
|
#1
|
LQ Newbie
Registered: Jun 2013
Distribution: Whatever works for the job.
Posts: 25
Rep: 
|
Shell script to make html pages of image embeds for lots of photos
So best I can figure is cat some variables and some bash functions. I have no idea where to start this. But I have some phots I want to stick on my personal server to access from my phone. So I want to make one page for eache photo with nav buttong left and right will work. The picture are formatted "foo.001" With number going up as it progresses very logical. However I look at this problem and my mind goes blank I can't see and attack avenue other than manually making every single file. Not worth it as I can just look at them in that time. I am fairly certain it's doable but I just blank every time I open up an editor to start. Any tips?
Side Note, I would not turn down a spoon fed answer links to the right resources would not be unwelcome ^_^ Either way thanks for you time even if you just read and move on.
--Djyou
|
|
|
11-23-2013, 10:53 AM
|
#2
|
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791
|
Found a Perl script at MarginalHacks.com that worked for me when I set up a slideshow of images from an overseas trip I took last summer.
|
|
|
11-23-2013, 01:27 PM
|
#3
|
LQ Muse
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,674
|
for html code on a web site
you are better off using a program like "Gallery"
http://galleryproject.org/
most CMS's will be able to run it
manually building static HTML pages is not going to give you good results
this is not the 1990's
|
|
|
11-23-2013, 02:03 PM
|
#4
|
Member
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334
Rep:
|
|
|
|
11-23-2013, 02:51 PM
|
#5
|
LQ Newbie
Registered: Nov 2013
Location: Germany
Distribution: Debian
Posts: 1
Rep: 
|
Code:
#!/bin/bash
oldifs=$IFS
IFS=$'\n'
IMGARRAY=""
for img in $(ls *.{png,jpg,jpeg,gif,svg} 2>/dev/null)
do IMGARRAY="$IMGARRAY\"$img\","
done
IFS=$oldifs
IMGARRAY=${IMGARRAY%?}
#echo "$IMGARRAY"
cat > view.html << EOHF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>View Images</title>
<script type="text/javascript">
var imagearray = new Array($IMGARRAY)
var index = 0
function next() {
if (index < imagearray.length - 1) {
index = index + 1
document.getElementById("image").src = imagearray[index]
}
}
function prev() {
if (index > 0) {
index = index - 1
document.getElementById("image").src = imagearray[index]
}
}
</script>
</head>
<body>
<img id="image" src=""></img><br />
<dive align="center"><a href="#" onclick="prev()">« Previous</a> <a href="#" onclick="next()">Next »</a></div>
<script type="text/javascript">document.getElementById("image").src = imagearray[index]</script>
</body>
</html>
EOHF
Last edited by Potatoe; 11-23-2013 at 07:01 PM.
|
|
1 members found this post helpful.
|
11-23-2013, 06:58 PM
|
#6
|
LQ Newbie
Registered: Jun 2013
Distribution: Whatever works for the job.
Posts: 25
Original Poster
Rep: 
|
Whoa, Thanks pototatoe and everyone else. The reading material is appreiciated as is the script.
Was not expected this many replies so thanks.
--Djyou
|
|
|
All times are GMT -5. The time now is 04:29 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|