473,789 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need help with my gallery

Hi everybody
I have yet another problem, actually two but lets start with this
one :-)
Im making a very simple gallery or at least I think its simple.
I have already made a upload script that uploads and resizes the image
and also creates a thumbnail.
So now I have my folder "images/galleri/" and "images/galleri/thumbs".
Now its time to dynamically display the images on a page.
I have set the $filename variable to display the thumbnails as you can
see below but how do I set the $filename_stor to link to the large
image. Perhaps im "attacking" this problem all wrong? I have tried to
nest another foreach in the first but that just messed everything up.

<?php
foreach (glob('images/galleri/thumbs/*.jpg') as $filename ) {
echo '<td><a href="'.$filena me_stor.'" rel="milkbox[]" <img
src="'.$filenam e.'" </a>'."&nbsp;&nbs p;</td>";
}
?>
The 2nd problem is that I want the images in a table that is no more
than 6 colums wide and N number of rows. Im thinking that I proberly
need to use an array!?

Any suggestions or solutions are very welcome
I hope you can help me.

-Effix
Aug 9 '08
13 1344
Message-ID: <MP************ ***********@new s.newsreader.co mfrom Krustov
contained the following:
>
Not really paid much attention to this thread - but shouldnt that be the
following .....

$filename=subs tr(strrchr($fil epath,"/"),1) ;
No, in this instance it's $filename=subst r(strrchr($file name,"/"),1) ;
>
Or perhaps you could use basename as it does the job in this particular
case .
Yes, I'd forgotten about that function.

--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011
http://slipperyhill.co.uk
Aug 10 '08 #11
On 10 Aug., 17:21, Geoff Berrow <blthe...@ckdog .co.ukwrote:
Message-ID:
<b9058dc3-6a0b-41e3-b779-2496d6acf...@k7 g2000hsd.google groups.comfrom
Effix contained the following:
Aah I see I was trying to use trim() to remove the path from the array
but that didnt work :)
Altohug I cant seem to get strrchr to work either, im sorry to be such
a bother. Apparently it strips the path but no filename appears efter
the last /

Don't worry about being confused, it probably has a lot to do with me
being lazy and not explaining properly.

Look at this:

foreach($filena me_array as $filename){
$filename= substr(strrchr ($filepath,"/"), 0, 20) ;
...

$filepath in this instance was meant to be the output from your array
(with the path bit that you didn't want)
substr() was being used to strip off the leading '/'.

So it should be:-

foreach($filena me_array as $filename){
//strip path so we just have filename
$filename= substr(strrchr ($filename,"/"), 1) ;
...

--
Geoff Berrow *01100010011011 00010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011htt p://slipperyhill.co .uk
Aaah I see now it makes a lot more sense :) I cant belive I didnt
figure that one out myself ofcourse its the filename that needs to be
stripped and not the path as I did.
Thank your very much for your help Geoff! :)
Aug 11 '08 #12
On 11 Aug., 10:35, Effix <Morteneist...@ gmail.comwrote:
On 10 Aug., 17:21, Geoff Berrow <blthe...@ckdog .co.ukwrote:


Message-ID:
<b9058dc3-6a0b-41e3-b779-2496d6acf...@k7 g2000hsd.google groups.comfrom
Effix contained the following:
>Aah I see I was trying to use trim() to remove the path from the array
>but that didnt work :)
>Altohug I cant seem to get strrchr to work either, im sorry to be such
>a bother. Apparently it strips the path but no filename appears efter
>the last /
Don't worry about being confused, it probably has a lot to do with me
being lazy and not explaining properly.
Look at this:
foreach($filena me_array as $filename){
$filename= substr(strrchr ($filepath,"/"), 0, 20) ;
...
$filepath in this instance was meant to be the output from your array
(with the path bit that you didn't want)
substr() was being used to strip off the leading '/'.
So it should be:-
foreach($filena me_array as $filename){
//strip path so we just have filename
$filename= substr(strrchr ($filename,"/"), 1) ;
...
--
Geoff Berrow *01100010011011 00010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011htt p://slipperyhill.co .uk

Aaah I see now it makes a lot more sense :) I cant belive I didnt
figure that one out myself ofcourse its the filename that needs to be
stripped and not the path as I did.
Thank your very much for your help Geoff! :)- Skjul tekst i anførselstegn -

- Vis tekst i anførselstegn -
Is there anyway to sort the glob() by date rather than filename?
php.net says nothing about this. So my initial thought is to do
something like :
sorted_files=ar ray()
foreach (glob(*.jpg)) as $filename) {
$sorted_files[$filename] = filemtime($file name)
arsort($sorted_ files)

this is not finished code so i know it doesnt work but do you guys
think it will work?
-Effix
Aug 11 '08 #13
Message-ID:
<15************ *************** *******@d45g200 0hsc.googlegrou ps.comfrom
Effix contained the following:
>Is there anyway to sort the glob() by date rather than filename?
php.net says nothing about this. So my initial thought is to do
something like :
sorted_files=a rray()
foreach (glob(*.jpg)) as $filename) {
$sorted_file s[$filename] = filemtime($file name)
arsort($sorted _files)

this is not finished code so i know it doesnt work but do you guys
think it will work?
It might work if you did this:

$sorted_files[filemtime($file name)] = $filename;
krsort($sorted_ files);
--
Geoff Berrow 011000100110110 0010000000110
001101101011011 001000110111101 100111001011
100110001101101 111001011100111 010101101011
http://slipperyhill.co.uk
Aug 11 '08 #14

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

Similar topics

10
2283
by: Captain Ranger McCoy | last post by:
Hello! Suppose I have ten servers at ten ips: x.x.x.1 x.x.x.2 x.x.x.3 x.x.x.4 and so on Each server hosts 100+ photo galleries, all under a single domain name,
1
1798
by: Chris Shipley | last post by:
I am trying to present a list of links on a page (Form) where each link opens a different picture gallery. I have the Form page which contains the links, a Gallery page, and several include files. Each include file displays a different gallery. Clicking on a link submits a value identifying the chosen gallery to the Gallery page. The Gallery page accepts the value from the Form page and uses it to call the appropriate include file. The...
2
2534
by: robert | last post by:
I've made a gallery site for an artist and it works well -- the gallery page has a central large image which is swapped when thumbnail images are clicked. I'm using Dreamweaver's "SwapImage" behavior. The problem is that this fails under certain versions of IE and possibly NN on PCs and Macs -- I haven't gotten my client to send me details of what version he's using (sorry) or any of my 'beta testers' -- but I'm really getting frustrated....
7
3271
by: Eric Lindsay | last post by:
I would like to do a photo gallery with a liquid layout. I wanted to center a caption below each photo (or above each photo). I can do that easily with tables, but then I don't have a liquid layout. Besides, I wanted to try to do it with CSS. I can do centered captions with text-align. This works provided the element containing each photo is floated left. I have found several examples of how to do this. However I didn't want the...
1
2326
by: gescom | last post by:
My goal is to create essentially two galleries on a single page, in which the first gallery determines what the second gallery displays. For instance, the first gallery refers to the contents of the main image folder. The second gallery would be a folder inside the main image folder. Depending on which image is displayed, the first gallery's image would trigger the second gallery's contents. I suppose this is sort of a hierarchal gallery...
1
1261
by: 4wheelinwilly | last post by:
I am somewhat new to PHP, but really like it so far. I have created a database (MySQL) and upload/edit pages enabling the user to upload photos and descriptions. Outputing them in a gallery format is not a problem. What I am struggling with is when there are many photos. I would like to keep the gallery pages to 20 images. If there are 50 images in the database, how would I write a code to continue the gallery on subsequent pages? Keeping...
5
2122
by: dabhand | last post by:
Hi This page http://www.dabhand.co.nz/ayupdev/gallery-riders.html works great in IE but not in Firefox... any help would be appreciated. It refers to an external javascript file which I have included the code to below: The file name is imgriders.js - as referred to in source of the html file above. if (document.images) { image1 = new Image; image2 = new Image; image3 = new Image;
7
1831
by: MZ | last post by:
Hello, I have a webcam connected to the Internet. I can access the current static picture of the camera using an url link. It shows the picture with high resolution 1600x1200. I would like to have a batch program which will do what follows every some amount of time: 1. save the picture automatically on my local computer (which will be always running) 2. lower the resolution of the saved picture
2
2315
anfetienne
by: anfetienne | last post by:
hi, i've got a flash gallery which i've paid for. Im using swf object to import vars to the gallery....the var being imported is a html address to specify the location of files and folders. The problem is that the gallery detects the thumbnails and loads the 1st image but once i click on another image it wont load, i don't know why it it doing this and as it loads the thumbnails which are in the same location it shouldn't have a problem...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7529
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.