473,409 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Using The Same Page To Display A Hundred Pictures One Picture At A Time

I have over a hundred pictures I would like to present.

Is it practical to create and parse an array of pictures,
picture paths, et al using server-side scripting to
accomplish this?

I created an array already, and whereby, the HTML and Javascript
currently used amount to about 14KB for each of four different
pages, the PHP page I started working on is already over 35KB in
size (most of it is server side processing creating the array of
pictures).

What I'd like to do, is load the array only one time, and keep that
loaded so the page doesn't recreate the array each time, thus
minimizing the server side array creation.

Also, I think I'm running into some problems whereby the
javascript is messing up Google's parsing of the page.

I don't see creating 100 different html pages as an answer,
in the respect if something ever changes, that's one big mess
to update and major portion of the content and alot of files.
Am I wrong in trying to avoid doing it via strictly HTML
pages?

The pages exist at, and they represent swimming pools designed
by the owner of Aquatic Creations (North Carolina In-Ground
Swimming Pool Designers):

Custom Swimming Pool Water Features
http://aquaticcreationsnc.com/lib/php/viewing0.php
Custom Designed Swimming Pools
http://aquaticcreationsnc.com/lib/php/viewing1.php
Custom Designed Spas
http://aquaticcreationsnc.com/lib/php/viewing2.php
Custom Swimming Pool Features
http://aquaticcreationsnc.com/lib/php/viewing3.php
Stone And Tile Around Swimming Pools
http://aquaticcreationsnc.com/lib/php/viewing4.php

Does anyone have any suggestions on how to accomplish such
or directions to pursue?

If you could take a look as well and provide comments on the
pages, I appreciate constructive criticism as well.

Thanks much,

Jim Carlock
Post replies to the newsgroup.
Jan 29 '06 #1
13 3224
"What I'd like to do, is load the array only one time, and keep that
loaded so the page doesn't recreate the array each time, thus
minimizing the server side array creation."

Have you considered using sessions? You could use them to create a
temporary cache of the array quite easily.

<?php
session_start();
if (!isset($_SESSION['array_cache'])) {
$array = array('value', 'value');
$_SESSION['array_cache'] = $array;
} else {
$array = $_SESSION['array_cache'];
}
?>

Jan 29 '06 #2
Al
Jim Carlock wrote:
I have over a hundred pictures I would like to present.

Is it practical to create and parse an array of pictures,
picture paths, et al using server-side scripting to
accomplish this?

I created an array already, and whereby, the HTML and Javascript
currently used amount to about 14KB for each of four different
pages, the PHP page I started working on is already over 35KB in
size (most of it is server side processing creating the array of
pictures).

What I'd like to do, is load the array only one time, and keep that
loaded so the page doesn't recreate the array each time, thus
minimizing the server side array creation.


First, cool animations :)

Also, I'm not sure exactly what it is that you want to do? What's the
problem with server-side array creation? The problem is that whatever
you do you'll HAVE to load that data in somehow. If you used the
session cookies as has been mentioned you still have a 30-odd-kB array
to go through, if you load it in from a file you still have the array.
There is one way you can do it so you don't have the whole array in
memory at one time, and that's using a database. That way you're just
pulling the bit of the 'array' that you need at any one time, however I
think the database route is a little surplus to requirements in this
situation.

At the moment you're using javascript to change the picture on the fly
without resorting to a page reload but if I'm reading your post
correctly you wouldn't mind if the page had to be refreshed to change
the picture, as long as the html for it was small.

In which case PHP can indeed help you. Just have the large array as a
PHP array and have certain parameters on the command (url) line. For
instance you say you have about 100 pictures, well in the array they'll
be given the indices 0 to 99 (or whatever) so you can pass something
like getpicture.php?picturenum=30 to get a particular picture. That's
simple enough and should output a relatively small HTML page (as you
will no longer have the javascript.)

The problem comes when you need to have that thumbnail bar. If that's
done as static HTML then you can only have one bar for each image, and
thus for the user to be able to see all three preview bars they'll have
to go to three different areas of pictures. However you CAN do it using
javascript like you currently are but this'll bring your page's size
back up. Still, you won't have the large array in the outputted
html/javascript and so it'll still be quite small.

Basically I think what you need to do (and what you're pretty much
wanting to do) is get the large array out of the html (so it isn't
downloaded every time) but keep the same functionality. And doing it in
PHP using the method I've explained will do this for you. Remember it
doesn't matter if the PHP file is 100kB of array processing, the
outputted html page can be as small as you like.

If you want a more detailed explanation with some sample code then say
so and I'll do my best to come up with something usable, but I think
you get the gist of what you need to do. Basically get all of that
javascript array processing out of the html and into the PHP file. It's
as simple as that.
Of course if that's NOT what you wanted then sorry if I've been
patronising or anything, and feel free to clarify your problem.

Jan 29 '06 #3
Just download the program I used in my other thread to do all of it for
you. It is completely free and very powerful.

http://groups.google.com/group/comp....2f6061b4fe1d58

Now if you could be so kind as to tell me why the heck PHP isn't
working on this new web I would appreciate it. ;-)

Brent

Jan 30 '06 #4
<br*********@lyricvault.com> wrote:
Now if you could be so kind as to tell me why the heck PHP
isn't working on this new web I would appreciate it. ;-)


I believe for IIS you right click inside the MMC for IIS on the
website in question, then click upon Properties..., and thereby
set the ISAPI ext to include PHP.

There might be a way to set up the appropriate PHP dll for all
sites, but I'll let you tell me that. Make sure you employ the DLL
(as opposed to putting PHP in the path and employing php.exe).

Hope this helps.

Jim Carlock
Post replies to the newsgroup.
Jan 30 '06 #5
<xc*****@gmail.com> posted:
Have you considered using sessions? You could use them to create
a temporary cache of the array quite easily.


<?php
session_start();
if (!isset($_SESSION['array_cache'])) {
$array = array('value', 'value');
$_SESSION['array_cache'] = $array;
} else {
$array = $_SESSION['array_cache'];
}
?>

Thanks, Clark(?). I'll give that a go.

Jim Carlock
Post replies to the newsgroup.
Jan 30 '06 #6
Al
Jim Carlock wrote:
<xc*****@gmail.com> posted:
Have you considered using sessions? You could use them to create
a temporary cache of the array quite easily.


<?php
session_start();
if (!isset($_SESSION['array_cache'])) {
$array = array('value', 'value');
$_SESSION['array_cache'] = $array;
} else {
$array = $_SESSION['array_cache'];
}
?>

Thanks, Clark(?). I'll give that a go.

Jim Carlock
Post replies to the newsgroup.


I admit I don't know the internal workings of PHP too well, but I'm
really not sure storing the array as a session variable will actually
help anything.
As far as I can tell session variables are just little text files
stored server-side per connection. As such there are two points:

1) you're just loading the array from a text file, so it makes no
difference whether you're loading it from the text file or creating it
in the script

2) it may actually be serialised to be put in said text file, and as
such you're actually incurring extra time serialising and unserialising
it every page refresh.

Plus even if this way does manage to save some server processing (in a
way I can't see) then it'll only work on subsequent page loads of each
session. As such the array still has to be created once per
user/session of the web site. If the array isn't going to change it
might be best to create the array and serialise it to a text file
that's open for everyone. That way the script can just load it from
there even for the first load per session. And if it only changes every
now and again (i.e. with an update from you rather than in the script
over a session) then you can make a separate script that will load it
in, make the changes, and then save it again.

But I could be way off with the way sessions work.

Feb 1 '06 #7
"Al" <al************@gmail.com> wrote:
<snip>...</snip>

The way it exists currently, the javascript fails to help in regards
to search engines. Each image carries some associated text, and
soon it will carry the following independent items:

<meta name="description" ... />
<meta name="keywords" ... />
<title>Independent Title</title>
<h1>Independent Heading For the Image</h1>
<p>Independent text for the image in question.</p>

And the page to view the image will contain keywords...

I'm trying to figure out which will work better of the following two
methods. The goal is to help address search engines and create
a server side manner in which to display the pages, employing
keywords in the addressbar.

(1) swimmingpool.php?id=1
(2) view.php?type=swimmingpool&id=1
or by getting rid of the numerical identifiers...
(3) view.php?type=customswimmingpool&pool=customguitar pool

Keywords for each image and search engines are the goals. I
wanted to avoid creating independent HTML pages, but that might
represent the best way to go as far as search engines goes, and
place them inside the appropriate folders on the server.

Some people try to change the text on images to get Google to
come back to their website more often. But I tend to think that
Google probably caught onto that a long time ago and drops
everything after the question mark (?). I imagine Google might
skip changing dates as well. For instance if the only thing that
changes on the page is a current date...

What the owner of the website really wants is to get their
name to the top of the google search engine when someone
types in:

<a href="http://aquaticcreationsnc.com">Raleigh Swimming Pool Builder</a>

Along with a couple other things... So I might need to work that
into the ?title=RaleighSwimmingPoolBuilder&swimmingpool=1

Those are my thoughts, and I'm kind of hesitating and exploring
other options before I push into one way or the other.

It took Google 3 months to grab the website, which should only
really be one month. Based upon my initial tests in the past, it
only takes a month to get a webpage recognized by Google,
when only one link is created inside a newsgroup.

Hope that helps explain why I decided to move in the server
side direction. The javascript works nicely, as far as displaying
images goes. I've read some things though that indicate that
Google doesn't run as a javascript client and therefore tends
to miss everything that goes on with the webpage as it exists
right now. I don't know how long I'm going to have wait
before google picks up on the page...

http://aquaticcreationsnc.com/lib/php/viewing0.php

And thanks for commenting that the images are nice. I
normally reduce the size and change some things, they
are quite big at the moment, but then again, the people
that they're targeting are people with big homes and fast
internet connections, so I left the images as 300Kb files.
Gif's tend to become problematic for Internet Explorer
machines as well. If you open one of those images up
inside of Internet Explorer then open another browser
up, if your machine isn't the latest greatest top of the
line, you notice the images acting funny when browsed
by Internet Explorer.

Thanks for your suggestions Al. Hope this helps.

Jim Carlock
Post replies to the newsgroup.
Feb 2 '06 #8
For arrays of arrays, how do I access the "ani/pic-1.gif" element?

$aImages = array("custom_pools", array(array("ani/pic-1.gif",
"Replica 1974 Gibson Les Paul Guitar", "pic-1.jpg",
"description", "pagetitle", "metadescription", "metakeywords",
"<h1>h1</h1>"),

I tried $aImages[0][0] but that returns "c".
I then tried $aImages[0][1], and that returns "u".
I then tried $aImages[0][0][0] and that returns an empty string.

I did get another array(array to return the proper values, but now
that I placed a string as the first element and an array of arrays as
the second element... :-z

Thanks.

Jim Carlock
Post replies to the newsgroup.
Feb 4 '06 #9
Jim Carlock wrote:
For arrays of arrays, how do I access the "ani/pic-1.gif" element?

$aImages = array("custom_pools", array(array("ani/pic-1.gif",
"Replica 1974 Gibson Les Paul Guitar", "pic-1.jpg",
"description", "pagetitle", "metadescription", "metakeywords",
"<h1>h1</h1>"),

I tried $aImages[0][0] but that returns "c".
I then tried $aImages[0][1], and that returns "u".
I then tried $aImages[0][0][0] and that returns an empty string.


try

echo '<pre>'; print_r($aImages); echo '</pre>';

--
If you're posting through Google read <http://cfaj.freeshell.org/google>
Feb 4 '06 #10

Jim Carlock wrote:
"Al" <al************@gmail.com> wrote:
<snip>...</snip>

The way it exists currently, the javascript fails to help in regards
to search engines. Each image carries some associated text, and
soon it will carry the following independent items:

<meta name="description" ... />
<meta name="keywords" ... />
<title>Independent Title</title>
<h1>Independent Heading For the Image</h1>
<p>Independent text for the image in question.</p>

And the page to view the image will contain keywords...
You're going to need to create (or have php create for you) separate
pages then. That doesnt mean that your curent JS gallery is out of the
question though. You can have it both ways. You need to make your
prev/next buttons be a real link and a js trigger:

<a href="/view.php?album=pools&pic=guitar.jpg"
onClick="JSfunctionThatShowsTHeNextPic(); return false"><img
src="/NextPicIcon.jpg"></a>

That will do the next pic in JS for most users, and for non JS browsers
and google, it will work like a regular link. (well, I know it works
for non-JS users, I dont know for certain about google)

You've got to get php to do all that figuring out for you though.

Here's what you're going to do:
1. look in the specified folder, make a list (array) of the picture
files.
2. go through the list, read in the key words and other text that
matches each pic from a DB or txt files.
3. spit out the JS and the html to make the gallery and the keywords.

I'm trying to figure out which will work better of the following two
methods. The goal is to help address search engines and create
a server side manner in which to display the pages, employing
keywords in the addressbar.

(1) swimmingpool.php?id=1
(2) view.php?type=swimmingpool&id=1
or by getting rid of the numerical identifiers...
(3) view.php?type=customswimmingpool&pool=customguitar pool
How 'bout
pool-custom-guitar.htm

You need .htaccess to tell mod_rewrite to 'rewrite' your URL. It will
take the URL above and translate it into:
view.php?type=custom&pool=guitar

(by the way, send those boys up to my house, I'd like one of those
guitar pools. Make mine a tele, though ;)
Keywords for each image and search engines are the goals. I
wanted to avoid creating independent HTML pages, but that might
represent the best way to go as far as search engines goes, and
place them inside the appropriate folders on the server.

Some people try to change the text on images to get Google to
come back to their website more often. But I tend to think that
Google probably caught onto that a long time ago and drops
everything after the question mark (?). I imagine Google might
skip changing dates as well. For instance if the only thing that
changes on the page is a current date...


For what it's worth, google doesnt seem to have a problem with indexing
my ugly php urls...
--
j

Feb 4 '06 #11
Jim Carlock wrote:
For arrays of arrays, how do I access the "ani/pic-1.gif" element?

$aImages = array("custom_pools", array(array("ani/pic-1.gif",
"Replica 1974 Gibson Les Paul Guitar", "pic-1.jpg",
"description", "pagetitle", "metadescription", "metakeywords",
"<h1>h1</h1>"),

I tried $aImages[0][0] but that returns "c".
I then tried $aImages[0][1], and that returns "u".
I then tried $aImages[0][0][0] and that returns an empty string.

I did get another array(array to return the proper values, but now
that I placed a string as the first element and an array of arrays as
the second element... :-z

Thanks.

Jim Carlock
Post replies to the newsgroup.


$aImages[0] is "custom_pools", so it's returning exactly what it's
supposed to - the first or second character in the string.

$aImages[1][0][0] is "ani/pic-1.gif". You also have $aImages[1][0][1],
$aImages[1][0][2], etc.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Feb 4 '06 #12
"Pedro Graca" <he****@dodgeit.com> answered:
try

echo '<pre>'; print_r($aImages); echo '</pre>';
Thanks, Pedro. That's going to be indispensable when messing with
arrays. I've done that with PHP's built-in arrays. The power of
suggestion... Thanks!

Jim Carlock
Post replies to the group.

Jim Carlock originally posted/asked: For arrays of arrays, how do I access the "ani/pic-1.gif" element?

$aImages = array("custom_pools", array(array("ani/pic-1.gif",
"Replica 1974 Gibson Les Paul Guitar", "pic-1.jpg",
"description", "pagetitle", "metadescription", "metakeywords",
"<h1>h1</h1>"),

I tried $aImages[0][0] but that returns "c".
I then tried $aImages[0][1], and that returns "u".
I then tried $aImages[0][0][0] and that returns an empty string.

Feb 4 '06 #13
Message-ID: <11**********************@g47g2000cwa.googlegroups .com> from
juglesh contained the following:
(by the way, send those boys up to my house, I'd like one of those
guitar pools. Make mine a tele, though ;)


Strats are more shapely :)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Feb 4 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthew Robinson | last post by:
im crap with javascript, im not so hot with php, but anyway here's what ive got <script type="text/javascript"> var lay1=0 var lay2=0 function showpicture() { lay2=0 if (lay1%2==0) {...
6
by: Tim Streater | last post by:
I want to generate a web page using PHP, and in the middle generate a graphic I read from another server. So the graphic is in $picture. So I can either write $picture to a temp file and then use...
6
by: juglesh | last post by:
hi, I'm just getting started here in php, but i've been able to get some basic variable stuff working, so I'm just looking for advice on the basic set up of some thumbnail->picture pages. the...
1
by: bborden | last post by:
Novice Access programmer here. I would like to display an image using the Toolbox Image object by calling the images file name using: =fPictureFiles(!!,1) in the Picture control. Below...
3
by: DL | last post by:
Hi, Many questions have already been asked and answered about images in Access... But despite having searched, I have not found an answer to the following question... In my DB, several forms...
6
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the...
4
by: Doug van Vianen | last post by:
Hi, I have the following coding on a web page. It causes two pictures (pic1.jpg and pic2.jpg) to show, one above the other and then when one clicks on the top picture is squeezes to the left...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
2
by: smorrison64 | last post by:
I have a form that is coded to open a File Dialog boc to pick a picture to display on that particular item on a subform. My form is not based on query, but rather two separate tables (one primary,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.