Hi latterd,
for my existing image upload validation I'm using multiple zf validators
with custom error messages:

array('Extension', true, array(
        'extension' => explode(',', $this->config->valid_upload_types),
        'messages' => array(
                'fileExtensionFalse' => 'Invalid picture type'
        )
)),
array('IsImage', true, array(
        'magicFile' => false,
)),
array('Size', true, array(
        'max' => $this->config->max_upload_size,
        'messages' => array(
                'fileSizeTooBig' => 'Picture size is too big'
        ),
)),
array('ImageSize', true,
        array(
                'minwidth' => $minSize->minwidth,
                'minheight' => $minSize->minheight,
                'maxwidth' => $this->config->max_width,
                'maxheight' => $this->config->max_height,
                'messages' => array(
                        'fileImageSizeHeightTooBig' => 'Picture height is too 
big',
                        'fileImageSizeWidthTooBig' => 'Picture width is too 
big',
                ),
        ),
),

are you suggesting that there is no way around this but only to create
custom validations such as the use of the getimagesize() function?

also is it possible to use getimagesize() before uploading the image to the
server (even to the /tmp folder)?

Thank You!
Roman.



latterd wrote
> Hi,
> 
> You can find out file information using:
> http://php.net/manual/en/function.finfo-file.php
> 
> Also, a common way is to use getimagesize() function, if it throws an
> error
> or returns false its not an image.
> 
> I think it is a 2 step process, first you get the image from the url,
> validate etc.
> 
> Then upload/send to your server.
> 
> 
> 
> On 26 May 2015 at 17:05, cmple <

> roman.vidyayev@

> > wrote:
> 
>> Hey Alejandro,
>> Thanks for your reply!
>> I have one more question, how can I apply the file Validation without
>> using
>> the global $_FILES[] variable?
>>
>> for example:
>> $validator = new Validator\IsImage();
>> $valid = $validator->isValid();
>>
>> Thanks!
>> Roman.
>>
>>
>>
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/ZF2-Import-and-validate-external-pictures-from-URLs-tp4662542p4662545.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>> --
>> List: 

> [email protected]

>> Info: http://framework.zend.com/archives
>> Unsubscribe: 

> [email protected]

>>
>>
>>





--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-Import-and-validate-external-pictures-from-URLs-tp4662542p4662547.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to