WeBBy posted on 2008-04-17 16:47:42 #
Having some problems with this script, hoping you can help out a bit:
1. Ignores the file dimension rules (x and y).
2. Says Uploaded successfully, but not uploaded.
See script:
http://www.basementquestions.com/login/loggedin/foto_upload.php
This is the original with only minor changes (configuration). File dimentions and upload directory (from variables) displayed.
You can submit any size (dimensions) image (x/y limits ignored) and will not actually upload anything.
Interstingly enough, if I change permissions on the upload file, I do get a permissions error so it is accessing the folder - just not doing anything. ALSO, if you try to upload an existing file nane, it does state that file name already exists. It is just not uploading.
http://www.basementquestions.com/phpinfo.php
http://www.basementquestions.com/login/loggedin/upload_demo.php
The upload demo page. THis works and is provided so that you can see the contents of the upload folder. Images uploaded from foto_upload will not appear.
Would use the simple upload_demo, but need to control dimensions.
Thanx for any help you can provide on this.
The most popular forum posts:
Comments / discussions
Olaf posted on 2008-04-17 19:10:07 #
check the permission for the upload/target directory (I guess I forgot to test if the directory is writable)
WeBBy posted on 2008-04-18 01:11:02 #
Permissions is set to 777. If the permissions were not ok, upload_demo would not wotk as it uses the same folder...
from above:
if I change permissions on the upload file, I do get a permissions error...
if you try to upload an existing file nane, it does state that file name already exists.
It just doesn't save the file although it says it is.
Permissions is not the issue
Also, permissions would not affect the x/y dimensions
Olaf posted on 2008-04-18 06:24:15 #
do you use the GD mode or the Imagemagick mode?
WeBBy posted on 2008-04-18 15:27:20 #
I had considered that also since some scripts seem to have a problem finding Imagemagick if the path is not defined (Have GD2+ and Imagemagick installed). Changing $use_image_magick to false in foto_upload had no effect.
Now, this is kinda weird...
If I upload a file with upload_demo.php, it uploads fine.
When I try to upload the SAME file with foto_upload.php, I get the expected file already exists.
If I check the Replace an old foto, it deletes the old foto, but does NOT replace it - it only deletes!
Olaf posted on 2008-04-18 15:39:42 #
yep the demo works fine (upload and download)
the other upload form doesn't upload to this directory:
/home/bquest/public_html/images/logos/
are these setting right? maybe you can start with the default example?
WeBBy posted on 2008-04-18 16:07:04 #
Yeah, this is really strange - it is just the foto_upload that won't upload!
are these setting right?
Definately, no question about this one. Have even tried setting the entire site to 777 and same thing.
Proof that they are correct: When selecting to REPLACE, the script does delete the "old" file. If it has delete permission, it certainly has write permission!! Try replacing yout avatar40.gif with the foto_upload and watch it dissapear.
maybe you can start with the default example?
Great minds must think alike!!
Since I am only trying to allow upload of a specfic size foto with no options, am currently trying to get an x/y restriction in the upload_example.php.
Not sure within my capabilities, but giving it a shot (less frustrating than trying to get foto_upload to write)
;)
FOUND THE ERROR !!!!!
In foto_upload you have...
On line 26:
function process_image($landscape_only = false, $create_thumb = false, $delete_tmp_file = false, $compression = 85) {
On line 131:
$foto_upload->process_image(false, true, true, 80);
Contradiction!!!
If you change line 131 to:
$foto_upload->process_image(false, false, false, 80);
IT UPLOADS !!!!!!!
No to find the x/y dimensions error !!
Olaf posted on 2008-04-18 17:43:07 #
it's not an error... just wrong a usage :D
(maybe the attribute $create_thumb is a little bit confusing in your case)
WeBBy posted on 2008-04-18 18:13:37 #
Any idea on the x-y values. A bit confused as to how you are figuring this one and opposed to file size, This x_size > y_size????
Olaf posted on 2008-04-18 18:45:57 #
the photo upload is just an example on how to extend the upload class. I know the resize logic is limited, let me see...
You define a maximum width and height, it should work with most of the dimensions. I remember me some issue together with the landscape option and images with the same width and height.
Look I made this photo extension for use with regular photo galleries (think about normal images coming from a digital camera)
WeBBy posted on 2008-04-18 18:53:27 #
WeBBy posted on 2008-04-19 03:54:45 #
Maybe you can give me a little pointer here and save me a buttload of time. From what I can see in your script, all the x/y dimensions relate to landscape mode and there really is no feature to limit the image size. So, I added:
$this->check_dimensions($filename);
if ($this->x_size <= $this->x_max_size and $this->y_size <= $this->y_max_size) {
return true;
}
else {
$this->message[] = $this->error_text(18);
return false;
}
This works in the sense that when an image is uploaded, the error message (18) is displayed, but I cannot seem to actually invoke an upload error (upload still occurs).
Care to share how to actually invoke the http error in the above?
Thanx
Olaf posted on 2008-04-19 06:21:39 #
The "photo" process is started after the upload is done. If there is no file after anything is done there is something wrong after the upload.
Start with more directories to keep always the original.