Jump to content

photogallery with JS and PHP


uisneach

Recommended Posts

Hello. :)

I need som advice to complete the creation of a photogallery realized in javascript but with php that increase everytime by one the number of images uploaded on the server.

e.g.

thisis the js

<script type="text/javascript" language="JavaScript">

 

var photos=new Array()

var which=0

 

/*Change the below variables to reference your own images. You may have as many images in the slider as you wish*/

 

photos[0]="photo/1.jpg"

photos[1]="photo/2.jpg"

photos[2]="photo/3.jpg"

photos[3]="photo/4.jpg"

photos[4]="photo/5.jpg"

 

 

function backward(){

if (which>0){

window.status=''

which--

document.images.photoslider.src=photos[which]

}

}

 

function forward(){

if (which<photos.length-1){

which++

document.images.photoslider.src=photos[which]

}

else window.status='End of gallery'

}

</script>

 

 

The list of pics is dynamic. Php moves the pics in the  directory photo".

$path="public/photos/";

 

 

$newname=$path.$las_id.".jpg";

 

move_uploaded_file($file_temp,$newname);

header("Location:pics.php");

How  to use php in this case? or is more a js issue?  ??? I need just to add the new pic uploaded using php to the gallery in JS. (Is it called ajax?)

thanks for advices ;)

 

 

 

Link to comment
Share on other sites

Hello

Another question: accordin to my point of view, i think should be better including js in php page instead of  using ajax xhttp rquest

anyone has a clue about how to make dyinamic this gallery using javsacript in a php page?  the code is posted above

 

thanks in  advancce

 

:)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.