473,382 Members | 1,441 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,382 software developers and data experts.

Pb sur un script

Bonjour ,

j'ai un petit pb sur mon script suivant :
<?php

// Ouverture de la session

session_start();

// Test si identification effectué et réussi

if (session_is_registered("s_register"))
{

echo "<BODY background='../../images/yfond44' text='#ffffff'
link='#ffffff' alink ='#ffffff' vlink='#ffffff' bgproperties='fixed'>";
echo "<h3><u>Photos </u></h3>";

// Test si 1 fichier se trouve dans le repertoire upload

$upload = opendir('./upload/');
$search = array();

// recherche plus particulierement les jpgs

while (false!== ($file = readdir($upload)))
{
// Si JPG , on stocke le nom

if (ereg("JPG$",$file)||ereg("jpg$",$file)) $search[]=$file;
}
fclose($upload);

// Si c le cas , creation des miniatures et rangement des photos dans le
dossier images

if (sizeof($search))
{

// Index du tableau a zero

$index=0;

// creation de la miniature et deplacement du fichier

do
{
$image_dest = imagecreatetruecolor(96,72);
$image_source =
imagecreatefromjpeg("./upload/".$search[$index]);

$larg_source = imagesx($image_source);
$haut_source = imagesy($image_source);

$larg_dest = imagesx($image_dest);
$haut_dest = imagesy($image_dest);

@imagecopyresampled($image_dest,$image_source,0,0, 0,0,
$larg_dest,$haut_dest,
$larg_source,$haut_source);

@imagejpeg($image_dest,"./mini/".$search[$index]);

$path_source = "./upload/".$search[$index];
$path_dest = "./images/".$search[$index];

@copy($path_source,$path_dest);

@unlink($path_source);
}
while ((++$index)<sizeof($search));

}

// Compte le nombre total d'image JPG du repertoire images

$image = opendir("./images/");
$nomjpg = array();
$nbjpg = 0;

// recherche plus particulierement les jpgs

while (false!== ($file = readdir($image)))
{
// Si JPG , on stocke le nom

if (ereg("JPG$",$file)||ereg("jpg$",$file))
{
$nomjpg[]=$file;
$nbjpg++;
}
}
fclose($images);

// Triage du tableau de nom de fichier

sort($nomjpg,SORT_REGULAR);

// Enregistre les variables de session

$_SESSION['nom_jpg'] = $nomjpg;
$_SESSION['nb_jpg'] = $nbjpg;

session_register('nom_jpg');
session_register('nb_jpg');

// Redirection vers la page d'affichage

echo "<SCRIPT language='JavaScript'>";
echo "window.location='./affiche2.php?courant=0';";
echo "</SCRIPT>";
}

else
{
header("Location: ../../index.php\n\n");
}

?>

Normalement le script sert a verifier si le dossier upload contient une ou
des images , si c le cas , il crée une miniature de celle ci et la range
dans le dossier images.

Il suit ce resonnement :

1 - Verifie si la personne c bien enregistré
2 - Ouvre le dossier upload et verifie s'il y a des fichiers jpg ou
JPG
3 - si c le cas creation de la miniature et rangement dans le
dossier images
4 - Ouvre le dossier images et recupere le nombre et les noms des
fichiers en l'affichage : affiche2.php

Mon problème est le suivant , si le dossier upload ne contient qu'une
dizaine d'images,aucun , par contre si
le dossier en contient plus , je suis obligé de relancer plusieurs fois le
script (vu que ca n'en prend qu'une dizaine à la fois).

Quelqu'un voit il d'ou vient le probleme ?



Jul 17 '05 #1
0 2002

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

Similar topics

6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
1
by: Allen | last post by:
I am trying to add an additional photo/hyperlink to the company web site (I didn't create it) without any luck. The mouseover feature 'highlights' pics by swapping them with another pic using this...
3
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
2
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
1
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 Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.