Forums / General / I need to hack limit size in image class

I need to hack limit size in image class

Author Message

Jorge estévez

Tuesday 15 April 2008 6:19:38 am

Regarding an ezpublish 3.8 site.

No matter what "limit size" I declare in my image class (from zero to any number), whenever I try to upload an image it gives me an error telling me that the image is bigger than the size I declare, so it does not allow me to upload any image.

Anyway as I am the only administrator at the site I would like to hack the system (very dirty solution indeed) so it uploads any image (with any size) and doesn't bother me again.

Where to hack seems to me the problem, so the comparison to the size of the file is skipped. Can I just delete attribute "size" at the image class?

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Bruce Morrison

Tuesday 15 April 2008 7:04:31 am

Hi Jorge

Sounds like it could be a php or even apache configuration issue an not an eZpublish one. What's the eror message you are seeing?

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Jorge estévez

Saturday 09 August 2008 2:41:02 am

I still neet to kow where to hack the size and allow any size. I am getting:
------------------------
El borrador no se pudo almacenar.

Falta información requerida o no es válida:

* Imagen: El tamaño del archivo subido excede el límite fijado de esta web: 1048576 bytes.
-----------------------

In english should be something like

Draft could not be saved
Required information needed
Image: The size exceeds the limit of 1048576 bytes.

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Saturday 09 August 2008 4:43:03 am

No matter the value of the image I set at the class definition I always get the same error:

----------------
Falta información requerida o no es válida:

* Imagen: El tamaño del archivo subido excede el límite fijado de esta web: 3145728 bytes.
--------------

It always says that the image exceeds the fixed value (in this case 3 magabytes), the same goes for 2, 4, 5 megabytes for the image....

My images are 35 kbtes, 50 kbytes....

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Saturday 09 August 2008 12:42:51 pm

Hello,

I did some investigation and went to: MYSITE\kernel\classes\datatypes\ezimage

And fount that ezimagetype.php checks out the size:

        if ( $canFetchResult == EZ_UPLOADEDFILE_EXCEEDS_MAX_SIZE )
        {
            $contentObjectAttribute->setValidationError( ezi18n( 'kernel/classes/datatypes',
                'The size of the uploaded file exceeds the limit set for this site: %1 bytes.' ), $maxSize );
            return EZ_INPUT_VALIDATOR_STATE_INVALID;
           
        }

So I made some comments to "return EZ_INPUT_VALIDATOR_STATE_INVALID;"

Not letting "size" be an invalid issue...

I managed to upload the image, but on the client's site the image does not show (not even a blank image), nothing at all... I should be close to a solution.

Did I miss something?

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

André R.

Sunday 10 August 2008 7:13:33 am

You might be hacking the wrong place, one possible reason its blocked is because a value set in the form MAX_FILE_SIZE stops it.

In the image (and ezmedia and ezbinaryfile) edit attribute template you'll find this:

<input type="hidden" name="MAX_FILE_SIZE" value="{$attribute.contentclass_attribute.data_int1|mul( 1024, 1024 )}" />

code in eZHTTPFile::canFetch:

case ( UPLOAD_ERR_FORM_SIZE ):
{
    return EZ_UPLOADEDFILE_EXCEEDS_MAX_SIZE;
}break;

default:
{
    return ( $maxSize == 0 || $_FILES[$http_name]['size'] <= $maxSize )? EZ_UPLOADEDFILE_OK:
                                                                         EZ_UPLOADEDFILE_EXCEEDS_MAX_SIZE;
}

So check if the return value is actually EZ_UPLOADEDFILE_OK, if not make sure you edit the right Content class and change the upload limit value.

php doc:
http://php.net/features.file-upload.errors

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom