Forum

Thread tagged as: Problem

Image resize on new assets module

I have set a width attribute on a perch image tag, to have perch scale down any images uploaded over that width (800px in this case). It doesn't seem to be resizing the image. They are still coming out full size (or in this case, throwing me a white page when I save the region). The image in the resource folder is still 4000px wide and 2mb in size.

Now Media

Now Media 0 points

  • 7 years ago

My template code

<img src="<perch:content type="image" id="image" label="Image" width="800" required="false" />" alt="<perch:content type="text" id="alt" label="Description" required="false" help="e.g. Photo of MD John Smith with his best wig on" title="true" />" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me your diagnostics report?

Perch: 2.5.1
Production mode: Production (100)
Installed apps: content (2.5.1), assets (2.5.1), perch_blog (4.1), perch_mailchimp (2.0.1)
DB driver: PDO
DB tables: perch2_blog_authors, perch2_blog_categories, perch2_blog_comments, perch2_blog_posts, perch2_blog_posts_to_categories, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_mailchimp_campaigns, perch2_mailchimp_history, perch2_mailchimp_log, perch2_mailchimp_stats, perch2_mailchimp_subscribers, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 5
App runtimes:
<?php
    include(PERCH_PATH.'/core/apps/content/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_blog/runtime.php');
    include(PERCH_PATH.'/addons/apps/perch_mailchimp/runtime.php');
?>
Scheduled tasks for perch_mailchimp: update_list_stats (60 mins)
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup
H1: 148a870c7463c04ff5bca4bab58def73
L1: a732cde5956c25690caca6daa2adb439
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.4.8: done
latest_version: 2.3.2
on_sale_version: 2.5.1
headerScheme: light
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /cms/resources/logo.png
update_2.4.9: done
perch_blog_post_url: /{sectionSlug}/{postSlug}
perch_blog_update: 4.0
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
perch_mailchimp_secret: 5e37ffa15a06f8051853da0b8577c878
perch_mailchimp_update: 2.0
perch_mailchimp_api_key: e8011933dd6c4b7e3f3152e516fffb1b-us4
perch_mailchimp_list_id: 612aca454b
perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug}
update_2.5: done
update_2.5.1: done
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: xxxxxx
PERCH_DB_SERVER: xxxxxx
PERCH_DB_DATABASE: xxxxxx
PERCH_DB_PREFIX: perch2_
PERCH_TZ: Europe/London
PERCH_EMAIL_FROM: developers@now-media.co.uk
PERCH_EMAIL_FROM_NAME: Now Media
PERCH_LOGINPATH: /cms
PERCH_PATH: /home/linweb31/e/xxxxx/user/htdocs/cms
PERCH_CORE: /home/linweb31/e/xxxxx/user/htdocs/cms/core
PERCH_RESFILEPATH: /home/linweb31/e/xxxxx/user/htdocs/cms/resources
PERCH_RESPATH: /cms/resources
PERCH_HTML5: 1
PERCH_ERROR_MODE: DIE
PERCH_DATE_LONG: %d %B %Y
PERCH_DATE_SHORT: %d %b %Y
PERCH_TIME_SHORT: %H:%M
PERCH_TIME_LONG: %H:%M:%S
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/linweb31/e/xxxxx/user/htdocs/cms/templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.4.14
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.0.91
MySQL server: 5.1.71-log
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, curl, hash, fileinfo, filter, ftp, gettext, gmp, SPL, iconv, pcntl, session, standard, posix, readline, Reflection, Phar, shmop, SimpleXML, sockets, mbstring, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, cgi-fcgi, bcmath, dba, dom, gd, imap, json, ldap, exif, mcrypt, mssql, mysql, mysqli, odbc, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, pspell, snmp, soap, tidy, xmlreader, xmlrpc, xmlwriter, xsl, zip, mhash, ionCube Loader
GD: Yes
ImageMagick: No
PHP max upload size: 20M
PHP max form post size: 20M
PHP memory limit: 64M
Total max uploadable file size: 20M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
PATH: /sbin:/usr/sbin:/bin:/usr/bin
PWD: /var/www/fcgi
PHP_FCGI_MAX_REQUESTS: 100
ORIG_SCRIPT_NAME: /fcgi-bin/php54-cgi
ORIG_PATH_TRANSLATED: /home/linweb31/e/xxxxx/user/htdocs/cms/core/settings/diagnostics/index.php
ORIG_PATH_INFO: /cms/core/settings/diagnostics/index.php
ORIG_SCRIPT_FILENAME: /var/www/fcgi/php54-cgi
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
REQUEST_URI: /cms/core/settings/diagnostics/?extended
QUERY_STRING: extended
REQUEST_METHOD: GET
SERVER_PROTOCOL: HTTP/1.0
GATEWAY_INTERFACE: CGI/1.1
REDIRECT_URL: /cms/core/settings/diagnostics/index.php
REDIRECT_QUERY_STRING: extended
REMOTE_PORT: 59322
SCRIPT_FILENAME: /home/linweb31/e/xxxxx/user/htdocs/cms/core/settings/diagnostics/index.php
SERVER_ADMIN: root@localhost
DOCUMENT_ROOT: /home/linweb31/e/xxxxx/user/htdocs
REMOTE_ADDR: 62.30.95.85
SERVER_PORT: 80
SERVER_ADDR: 127.0.0.1
SERVER_NAME: erca.nm-dev.co.uk
SERVER_SOFTWARE: Apache
HTTP_COOKIE: style=standard; cmssb=0; PHPSESSID=8dngcbkd15o17ko8knhpk3q381; cmsa=1
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_REFERER: https://xxxxx/cms/core/settings/diagnostics/
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_CONNECTION: close
HTTP_X_FORWARDED_FOR: 62.30.95.85
HTTP_X_REAL_IP: 62.30.95.85
HTTP_HOST: xxxxx
on: 127.0.0.1
REDIRECT_STATUS: 200
REDIRECT_HANDLER: application/x-httpd-php54
REDIRECT_on: 127.0.0.1
FCGI_ROLE: RESPONDER
PHP_SELF: /cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1404303442.8828
REQUEST_TIME: 1404303442
Drew McLellan

Drew McLellan 2638 points
Perch Support

If the image is 4000px wide, you could be hitting up against memory limits resizing it, although I'd be surprised. Can you confirm you're uploading the image and then actually using it in that region? The image is resized when it's used.

Yeah, I upload the image, via the region. Then select it, it registers in the field on the admin panel. Then when I save the region I get a white page, presumably silently throwing errors. Is there any way to show these errors?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

[Thu Jul 03 12:04:30 2014] [warn] mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted (tried to allocate 3200 bytes) in /home/linweb31/e/xxxxx/user/htdocs/cms/core/lib/PerchImage.class.php on line 585

So it is 9mb, but it's decompressing to larger than 64Mb

Drew McLellan

Drew McLellan 2638 points
Perch Support

File size and amount of memory required to manipulate an image aren't necessarily linked. Looks like you'll need to allow more memory if you want to manipulate images of that size and colour depth.

Not a chance of that on shared hosting unfortunately. We will just have to make sure the client doesn't upload anything too big. Is there any way to set a max filesize on an image field, so the client sees an understandable error

Drew McLellan

Drew McLellan 2638 points
Perch Support

The file size doesn't directly correlate to the memory needed, so that's not necessarily a great solution.

Yeah true. Ah well. We will just have to make sure the client isn't adding huge images in the first place. Thanks Drew.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Or just pony up a bit for some suitable hosting! :)