Jump to content

File/Image Description


matjazp
 Share

Recommended Posts

How to make File/image description field required? Eg. if file/image is uploaded, than description is mandatory.

How to use InputPageName Character replacements with file/image names in backend (admin mode)? That is, how to specify Sanitizer::translate (or number 2) for the $beautify param to the filename function in Sanitizer.php? 

When uploading files, filename should be sanitized by settings in InputPageName Character replacements, where "š" (for example) should be substituted by "s" but it is not. Running 2.5.4

Link to comment
Share on other sites

for the first Q, i don't know of that being possible, but you could try using admin custom files, and then use jquery.validate to do a client-side validation on the field in question... or maybe you need a totally custom module

Link to comment
Share on other sites

If your images have meaningful names, you could also substitute the image file name for the description if the description is empty. Something like this

$img = $page->my_image_field
$imgDesc = ($img->description == "") ? $img->name : $img->description;
//echo out your img tag

This way you wouldn't need custom module or hooks into InputPageName or custom form validation in backend.

It would be a nice feature though, if we could set the description to required in the image field settings.

Link to comment
Share on other sites

š character in image name:

I just tested this behaviour on both, a 2.5.2 and a 2.5.7 install.

uploaded an image with name "aua2š.jpg" and the name got converted to "aua2s.jpg".

So your problem there might be related to version 2.5.4.

Link to comment
Share on other sites

No, problem is (I think) in my environment: Windows Server 2012 and IIS with PHP.

The line 

if($this->lowercase) $value = strtolower($value);

 in WireUpload.php (line 216) converts š to ?, then sanitizer converts ? to _ (as it should). mb_strtolower is working fine. Maybe something Ryan should know?  

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...