close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

image width check

Thread began 4/07/2020 10:53 am by Jamie | Last modified 4/10/2020 11:26 am by Ray Borduin | 1051 views | 17 replies |

Jamie

image width check

Hi Ray

Is there a way to user the server validations to check and make sure that an image file is at least a certain width or would it need to be done with js?

Cheers

Sign in to reply to this post

Ray BorduinWebAssist

You can do it. The file upload server behavior will have the width and height available for image uploads. You can use that with number validation to add restrictions. You just have to manually move the upload code above the validation code.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

something like the attached?

Sign in to reply to this post

Ray BorduinWebAssist

It looks like that would work.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

OK

$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["ProductThumbnail"]))?$_FILES["ProductThumbnail"]:"") . "",1900,3000,"",",.",true,5);



Keeps failing validation with an image of 1920px width - when I comment out this validation, the image uploads without any problem at all

Sign in to reply to this post

Ray BorduinWebAssist

Can I get a url to reproduce and FTP access? I'll debug and see what is going on.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

sure..see PM and thanks

Sign in to reply to this post

Ray BorduinWebAssist

I see... since you are validating the $_FILES["ProductThumbnail"] value directly, you didn't need to move the file upload code above the validation. In fact, that deletes the temp file and caused the validation to fail.

I moved the file upload code back down below the validation and that seems to have resolved this issue.

Sign in to reply to this post
Did this help? Tips are appreciated...

Jamie

Thats great...many thanks Ray

Sign in to reply to this post

Jamie

Sorry but it wont allow a blank entry for some reason

$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["ProductThumbnail"]))?$_FILES["ProductThumbnail"]:"") . "",2000,"","",",.",false,5);
Sign in to reply to this post
loading

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