close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Image upload problem

Thread began 1/30/2013 9:44 am by mrs | Last modified 1/30/2013 11:38 am by Jason Byrnes | 544 views | 6 replies |

mrs

Image upload problem

Hi, I have an image upload file field in my form which creates a normal size file and a thumbnail, but for some reason the thumbnail isn't being created! It's not working on the update page either.

Basically, I am using the same file name for both images, but one is meant to be inserted into a _thumb folder within the imagesupload folder, so the file isn't being overwritten in any way. The image in the folder _thumb is the one not working.

Here's my code on the page for the upload code:


<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../imagesupload/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "800",
'ResizeHeight' => "",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "../imagesupload/_thumb/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "250",
'ResizeHeight' => "",
'ResizeFillColor' => "" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "fld_eventIMG", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>

If I'm missing any other code let me know. I can also give you access to the remote test site, but I'd need to give you that privately.

Also, don't know if this is part of the problem, but within the Image Upload wizard I am unable to set a width for a second image version when I click the + button. To set the size, I have to choose the width and height option, set my prefs there, then choose width which then registers the settings I want... either that, or I simply edit the arrays above to the settings I need.

What wrong here?

Sign in to reply to this post

Jason ByrnesWebAssist

to troubleshoot, make sure that page does not redirect after performing the upload, then add the following code at line 1 to turn on error reporting:

php:
<?php 

error_reporting
(E_ALL);
ini_set('display_errors','on');
?>



then open the bindings panel, and expand the uploaded files global status, add the debug info binding to your page.

post back the results after testing the upload again.

Sign in to reply to this post

mrs

Just done that and there is no error, however, the image upload now seems to be working too! Strange!!

Unless, what I think might've happened is that it wasn't working so I deleted all upload info, then reapplied it, and what happened is it created a file in imagesupload folder called abc123_1.jpg, and in the _thumb folder it created and image called abc123.jpg without the increment.

Is that how the upload works? For each file it needs to write, will it look into each folder it's writing to and then name+increment each file based on the content within the folder rather than based on a global name for all files being created?

If so, I might have set up my site wrong for this. I am using single column within the DB table and adjusting the path from imagesupload/abc123.jpg to imagesupload/_thumb/abc123.jpg

Sign in to reply to this post

Jason ByrnesWebAssist

  For each file it needs to write, will it look into each folder it's writing to and then name+increment each file based on the content within the folder rather than based on a global name for all files being created?  



yes, that is correct, the file renaming is on a per file basis.

In actual fact, we don't recommend using the resize option in the Upload anymore since we released image resizer.

It's better to only upload the original sized file, then use Image resizer to create the resized images on a page by page basis.

this way you can decide at a later date that the size you are using is to small, then just change the image settings to have it resized on that page, rather than have to re upload the image.

image resizer is much more flexible.

Sign in to reply to this post

mrs

Having just tried a few tests, it must be an issue with when the two folders are out of sync. I had different increments within the two folders which had got out of sync when I initially had the problem.

Hmmm... this could cause me some problems further down the line couldn't it?

Sign in to reply to this post

mrs

Is image resizer a drain on server resources? Could it be used on responsive sites that resize site structure by CSS to mobile screen sizes without creating too much lag in download time?

Sign in to reply to this post

Jason ByrnesWebAssist

it only uses server resources the first time the new image size is created. once the new image is created the first time, it is used by the site for each other time it is called.

image resizer users the size attributes on the image tag, not through css.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...