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
https://forums.phpfreaks.com/topic/146429-photogallery-with-js-and-php/
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

 

:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.