class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
So it means that the class has been called only 4 times, as it should.
I don't know why you have 8 images in the end. Have you tried to delete the 8 images before running the script again? How many are actually created when you run it?Reply
OKsystem information - class version : 0.30 - operating system : Linux - PHP version : 5.2.14 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : no restriction - upload_max_filesize : 64M (67108864 bytes) - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command MIME type detected as image/jpeg by UNIX file() command - MIME validated as image/jpeg source variables - You can use all these before calling process() file_src_name : 1house.jpg file_src_name_body : 1house file_src_name_ext : jpg file_src_pathname : /tmp/phpGPAtjw file_src_mime : image/jpeg file_src_size : 91083 (max= 67108864) file_src_error : 0 - source file is an image image_src_x : 536 image_src_y : 309 image_src_pixels : 165624 image_src_type : jpg image_src_bits : 8 process file to ./test/ - file size OK - file mime OK : image/jpeg - file name safe format - destination variables file_dst_path : ./test/ file_dst_name_body : 1house file_dst_name_ext : jpg - image operation, keep extension - checking for auto_rename - destination file details file_dst_name : 1house.jpg file_dst_pathname : ./test/1house.jpg - 1house.jpg doesn't exist already - image resizing or conversion wanted - source image is JPEG - setting destination file type to jpg - resizing... check x/y sizes resized image object created image_src_x y : 536 x 309 image_dst_x y : 500 x 288 - converting... fills in transparency with default color - saving image... JPEG image created image objects destroyed - process OK OKsystem information - class version : 0.30 - operating system : Linux - PHP version : 5.2.14 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : no restriction - upload_max_filesize : 64M (67108864 bytes) - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command MIME type detected as image/jpeg by UNIX file() command - MIME validated as image/jpeg source variables - You can use all these before calling process() file_src_name : 1house.jpg file_src_name_body : 1house file_src_name_ext : jpg file_src_pathname : /tmp/php3bYALR file_src_mime : image/jpeg file_src_size : 91083 (max= 67108864) file_src_error : 0 - source file is an image image_src_x : 536 image_src_y : 309 image_src_pixels : 165624 image_src_type : jpg image_src_bits : 8 process file to ./test/ - file size OK - file mime OK : image/jpeg - file name safe format - destination variables file_dst_path : ./test/ file_dst_name_body : 1house file_dst_name_ext : jpg - image operation, keep extension - checking for auto_rename auto_rename to 1house_1.jpg - destination file details file_dst_name : 1house_1.jpg file_dst_pathname : ./test/1house_1.jpg - 1house_1.jpg doesn't exist already - image resizing or conversion wanted - source image is JPEG - setting destination file type to jpg - resizing... check x/y sizes resized image object created image_src_x y : 536 x 309 image_dst_x y : 500 x 288 - converting... fills in transparency with default color - saving image... JPEG image created image objects destroyed - process OK OKsystem information - class version : 0.30 - operating system : Linux - PHP version : 5.2.14 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : no restriction - upload_max_filesize : 64M (67108864 bytes) - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command MIME type detected as image/jpeg by UNIX file() command - MIME validated as image/jpeg source variables - You can use all these before calling process() file_src_name : 1house.jpg file_src_name_body : 1house file_src_name_ext : jpg file_src_pathname : /tmp/phptdE34W file_src_mime : image/jpeg file_src_size : 91083 (max= 67108864) file_src_error : 0 - source file is an image image_src_x : 536 image_src_y : 309 image_src_pixels : 165624 image_src_type : jpg image_src_bits : 8 process file to ./test/ - file size OK - file mime OK : image/jpeg - file name safe format - destination variables file_dst_path : ./test/ file_dst_name_body : 1house file_dst_name_ext : jpg - image operation, keep extension - checking for auto_rename auto_rename to 1house_2.jpg - destination file details file_dst_name : 1house_2.jpg file_dst_pathname : ./test/1house_2.jpg - 1house_2.jpg doesn't exist already - image resizing or conversion wanted - source image is JPEG - setting destination file type to jpg - resizing... check x/y sizes resized image object created image_src_x y : 536 x 309 image_dst_x y : 500 x 288 - converting... fills in transparency with default color - saving image... JPEG image created image objects destroyed - process OK OKsystem information - class version : 0.30 - operating system : Linux - PHP version : 5.2.14 - GD version : 2.0.34 - supported image types : png jpg gif bmp - open_basedir : no restriction - upload_max_filesize : 64M (67108864 bytes) - language : en_GB source is an uploaded file - upload OK - file name OK determining MIME type - Checking MIME type with Fileinfo PECL extension Fileinfo PECL extension not available - Checking MIME type with UNIX file() command MIME type detected as image/jpeg by UNIX file() command - MIME validated as image/jpeg source variables - You can use all these before calling process() file_src_name : 1house.jpg file_src_name_body : 1house file_src_name_ext : jpg file_src_pathname : /tmp/phpxVpFaY file_src_mime : image/jpeg file_src_size : 91083 (max= 67108864) file_src_error : 0 - source file is an image image_src_x : 536 image_src_y : 309 image_src_pixels : 165624 image_src_type : jpg image_src_bits : 8 process file to ./test/ - file size OK - file mime OK : image/jpeg - file name safe format - destination variables file_dst_path : ./test/ file_dst_name_body : 1house file_dst_name_ext : jpg - image operation, keep extension - checking for auto_rename auto_rename to 1house_3.jpg - destination file details file_dst_name : 1house_3.jpg file_dst_pathname : ./test/1house_3.jpg - 1house_3.jpg doesn't exist already - image resizing or conversion wanted - source image is JPEG - setting destination file type to jpg - resizing... check x/y sizes resized image object created image_src_x y : 536 x 309 image_dst_x y : 500 x 288 - converting... fills in transparency with default color - saving image... JPEG image created image objects destroyed - process OKReply
You must be running the script twice. As you can see in the log, it creates only four images, the last one being file_dst_pathname : ./test/1house_3.jpgReply
You need to debug the code. Add some echo ... in your code, within your loop, etc... to see why it ends up creating too many images.
Is this somthing to do with it?
I don't know why you have 8 images in the end. Have you tried to delete the 8 images before running the script again? How many are actually created when you run it?
In total its displaying 4 ok along the top and also four file uploaded with success and the image names.
1house.jpg
1house_1.jpg
1house_2.jpg
1house_3.jpg
1house_4.jpg
1house_5.jpg
1house_6.jpg
1house_7.jpg
With only four upload slots, its managed to create 8 images?
Try to add the following line, just before unset($handle);
This will give you a lot of debugging information.
OKsystem information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.14
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : 1house.jpg
file_src_name_body : 1house
file_src_name_ext : jpg
file_src_pathname : /tmp/phpGPAtjw
file_src_mime : image/jpeg
file_src_size : 91083 (max= 67108864)
file_src_error : 0
- source file is an image
image_src_x : 536
image_src_y : 309
image_src_pixels : 165624
image_src_type : jpg
image_src_bits : 8
process file to ./test/
- file size OK
- file mime OK : image/jpeg
- file name safe format
- destination variables
file_dst_path : ./test/
file_dst_name_body : 1house
file_dst_name_ext : jpg
- image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : 1house.jpg
file_dst_pathname : ./test/1house.jpg
- 1house.jpg doesn't exist already
- image resizing or conversion wanted
- source image is JPEG
- setting destination file type to jpg
- resizing...
check x/y sizes
resized image object created
image_src_x y : 536 x 309
image_dst_x y : 500 x 288
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK
OKsystem information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.14
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : 1house.jpg
file_src_name_body : 1house
file_src_name_ext : jpg
file_src_pathname : /tmp/php3bYALR
file_src_mime : image/jpeg
file_src_size : 91083 (max= 67108864)
file_src_error : 0
- source file is an image
image_src_x : 536
image_src_y : 309
image_src_pixels : 165624
image_src_type : jpg
image_src_bits : 8
process file to ./test/
- file size OK
- file mime OK : image/jpeg
- file name safe format
- destination variables
file_dst_path : ./test/
file_dst_name_body : 1house
file_dst_name_ext : jpg
- image operation, keep extension
- checking for auto_rename
auto_rename to 1house_1.jpg
- destination file details
file_dst_name : 1house_1.jpg
file_dst_pathname : ./test/1house_1.jpg
- 1house_1.jpg doesn't exist already
- image resizing or conversion wanted
- source image is JPEG
- setting destination file type to jpg
- resizing...
check x/y sizes
resized image object created
image_src_x y : 536 x 309
image_dst_x y : 500 x 288
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK
OKsystem information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.14
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : 1house.jpg
file_src_name_body : 1house
file_src_name_ext : jpg
file_src_pathname : /tmp/phptdE34W
file_src_mime : image/jpeg
file_src_size : 91083 (max= 67108864)
file_src_error : 0
- source file is an image
image_src_x : 536
image_src_y : 309
image_src_pixels : 165624
image_src_type : jpg
image_src_bits : 8
process file to ./test/
- file size OK
- file mime OK : image/jpeg
- file name safe format
- destination variables
file_dst_path : ./test/
file_dst_name_body : 1house
file_dst_name_ext : jpg
- image operation, keep extension
- checking for auto_rename
auto_rename to 1house_2.jpg
- destination file details
file_dst_name : 1house_2.jpg
file_dst_pathname : ./test/1house_2.jpg
- 1house_2.jpg doesn't exist already
- image resizing or conversion wanted
- source image is JPEG
- setting destination file type to jpg
- resizing...
check x/y sizes
resized image object created
image_src_x y : 536 x 309
image_dst_x y : 500 x 288
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK
OKsystem information
- class version : 0.30
- operating system : Linux
- PHP version : 5.2.14
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 64M (67108864 bytes)
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME type detected as image/jpeg by UNIX file() command
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : 1house.jpg
file_src_name_body : 1house
file_src_name_ext : jpg
file_src_pathname : /tmp/phpxVpFaY
file_src_mime : image/jpeg
file_src_size : 91083 (max= 67108864)
file_src_error : 0
- source file is an image
image_src_x : 536
image_src_y : 309
image_src_pixels : 165624
image_src_type : jpg
image_src_bits : 8
process file to ./test/
- file size OK
- file mime OK : image/jpeg
- file name safe format
- destination variables
file_dst_path : ./test/
file_dst_name_body : 1house
file_dst_name_ext : jpg
- image operation, keep extension
- checking for auto_rename
auto_rename to 1house_3.jpg
- destination file details
file_dst_name : 1house_3.jpg
file_dst_pathname : ./test/1house_3.jpg
- 1house_3.jpg doesn't exist already
- image resizing or conversion wanted
- source image is JPEG
- setting destination file type to jpg
- resizing...
check x/y sizes
resized image object created
image_src_x y : 536 x 309
image_dst_x y : 500 x 288
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK