LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 11-23-2013, 01:18 AM   #1
Djyou
LQ Newbie
 
Registered: Jun 2013
Distribution: Whatever works for the job.
Posts: 25

Rep: Reputation: Disabled
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
 
Old 11-23-2013, 10:53 AM   #2
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
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.
 
Old 11-23-2013, 01:27 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,674

Rep: Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657Reputation: 2657
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
 
Old 11-23-2013, 02:03 PM   #4
propofol
Member
 
Registered: Nov 2007
Location: Seattle
Distribution: Debian Wheezy & Jessie; Ubuntu
Posts: 334

Rep: Reputation: 60
You could start with this:
https://snipt.net/ardchoille42/bash-...image-gallery/
 
Old 11-23-2013, 02:51 PM   #5
Potatoe
LQ Newbie
 
Registered: Nov 2013
Location: Germany
Distribution: Debian
Posts: 1

Rep: Reputation: Disabled
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>&nbsp;&nbsp;&nbsp;&nbsp;<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.
Old 11-23-2013, 06:58 PM   #6
Djyou
LQ Newbie
 
Registered: Jun 2013
Distribution: Whatever works for the job.
Posts: 25

Original Poster
Rep: Reputation: Disabled
Whoa, Thanks pototatoe and everyone else. The reading material is appreiciated as is the script.
Was not expected this many replies so thanks.

--Djyou
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shell script which can print desired pages from the document for_u_day@yahoo.com Linux - Newbie 4 02-17-2012 01:41 PM
shell script help with HTML formatting (??) cbtshare Programming 9 01-12-2010 11:09 AM
MS Publisher html pages for new web pages do not open in firefox, any suggestions?? Bwebman Linux - Newbie 3 06-13-2009 11:35 AM
managing photos.. lots of them! sharadbirmiwal Linux - Software 2 06-25-2005 03:05 PM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration