Forum

Thread tagged as: Problem, Gallery

Gallery images upload problem

Hi there

My client is having an issue uploading images to a gallery. Everything seems fine selecting and (seemingly) uploading the image, but when it finishes and the gallery refreshes, the image isn't in the gallery. I had a look on the server to see if the file had actually uploaded, but it has a file with a filename of '-1' (no extension) and the file size is 0 bytes. Adding more, just creates '-2', '-3' and so on.

Everything was fine on our staging server, but moving it to their server has brought out this behaviour. I'm certain it's a server configuration issue as they are hosting it on IIS. When we run it on Apache, it's fine.

I know it's a setup issue, but has anyone had this before? We've already had to tweak loads to get round IIS and it's funnies, but this one has us stumped. All the normal checks are ok (GD installed, resource dir writeable, latest version running etc..)

Oh, if I upload the same file through Assets, it's perfectly ok. It's just in the gallery app where the issue is.

Thanks in advance.

Michael Wilkinson

Michael Wilkinson 6 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Please post your Diagnostics Report, and the template which you are using when you have a problem.

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Rachel

This is the diagnostics report:

PERCH INFORMATION

Perch: 2.8.4
Production mode: Production (100)
Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_blog (4.6), perch_forms (1.8.3), perch_gallery (2.8.6)
DB driver: MySQLi
DB tables: perch2_blog_authors, perch2_blog_comments, perch2_blog_index, perch2_blog_posts, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_forms, perch2_forms_responses, perch2_gallery_albums, perch2_gallery_image_versions, perch2_gallery_images, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users
Users: 3
App runtimes:
<?php
    $apps_list = array(
        'content', 
        'categories',
        'perch_forms',
        'perch_gallery',
        'perch_blog',
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Editor plug-ins: markitup, redactor
H1: 95135f915b2039bae5ee8580f5829198
L1: 8103f651f55964bd63c98b8946334664
headerColour: #638a74
content_singlePageEdit: 1
helpURL:
siteURL: /
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.4: done
on_sale_version: 2.8.8
headerScheme: dark
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
logoPath: /site-login/resources/sandpit-grey-green-logo.png
perch_gallery_update: 2.8.5
perch_gallery_bucket_mode: single
perch_gallery_bucket: default
perch_gallery_basicUpload: 0
latest_version: 2.8.8
perch_blog_post_url: /blog/{postSlug}
perch_blog_slug_format: {postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_blog_comment_notify: 0
perch_blog_update: 5.0
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: sandpit_orchards
PERCH_LOGINPATH: /site-login
PERCH_DEBUG:
PERCH_DB_PREFIX: perch2_
PERCH_TZ: UTC
PERCH_EMAIL_FROM: admin@sandpitorchards.co.uk
PERCH_EMAIL_FROM_NAME: Sandpit Orchards
PERCH_PATH: C:\_WEBSITES\SandpitOrchards.co.uk\TEST\httpdocs\site-login
PERCH_CORE: C:\_WEBSITES\SandpitOrchards.co.uk\TEST\httpdocs\site-login\core
PERCH_RESFILEPATH: C:\_WEBSITES\SandpitOrchards.co.uk\TEST\httpdocs\site-login\resources
PERCH_RESPATH: /site-login/resources
PERCH_HTML5: 1
PERCH_RUNWAY:
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_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: C:\_WEBSITES\SandpitOrchards.co.uk\TEST\httpdocs\site-login\templates
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_RWD:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET:
PERCH_DB_PORT:
PERCH_DB_SOCKET:
HOSTING SETTINGS

PHP: 5.5.11
Zend: 2.5.0
OS: WINNT
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $
MySQL server: 5.5.42
Extensions: Core, bcmath, calendar, ctype, date, ereg, filter, ftp, hash, iconv, json, mcrypt, SPL, odbc, pcre, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, openssl, SimpleXML, wddx, xml, xmlreader, xmlwriter, cgi-fcgi, gd, mysql, Phar, mysqli, mhash
GD: Yes
ImageMagick: No
PHP max upload size: 2M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 2M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
PROCESSOR_ARCHITEW6432: AMD64
_FCGI_X_PIPE_: \\.\pipe\IISFCGI-da599a26-37ad-4e7f-a305-b260ab3d733d
PHP_FCGI_MAX_REQUESTS: 10000
PHPRC: C:\Program Files (x86)\PHP\v5.5
ALLUSERSPROFILE: C:\ProgramData
APPDATA: C:\Windows\system32\config\systemprofile\AppData\Roaming
APP_POOL_CONFIG: C:\inetpub\temp\apppools\xxxxxxxx\xxxxxx\xx.config
APP_POOL_ID: xxxxxxxxxx.co.uk
CommonProgramFiles: C:\Program Files (x86)\Common Files
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
CommonProgramW6432: C:\Program Files\Common Files
COMPUTERNAME: 674287-APP1
ComSpec: C:\Windows\system32\cmd.exe
DEVMGR_SHOW_DETAILS: 1
FP_NO_HOST_CHECK: NO
LOCALAPPDATA: C:\Windows\system32\config\systemprofile\AppData\Local
NIMROOT: C:\Program Files\Nimsoft\Nimsoft Robot x64\
NUMBER_OF_PROCESSORS: 12
OS: Windows_NT
Path: C:\Program Files (x86)\PHP\v5.5;C:\Program Files\Internet Explorer;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Dell\SysMgt\oma\bin;C:\Program Files (x86)\Dell\SysMgt\shared\bin;C:\Program Files (x86)\Dell\SysMgt\idrac;C:\Windows\System32\inetsrv;C:\Program Files\MySQL\MySQL Server 5.5\bin;
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE: x86
PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
PROCESSOR_LEVEL: 6
PROCESSOR_REVISION: 2d07
ProgramData: C:\ProgramData
ProgramFiles: C:\Program Files (x86)
ProgramFiles(x86): C:\Program Files (x86)
ProgramW6432: C:\Program Files
PSModulePath: C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC: C:\Users\Public
SystemDrive: C:
SystemRoot: C:\Windows
TEMP: C:\Windows\TEMP
TMP: C:\Windows\TEMP
USERDOMAIN: WORKGROUP
USERNAME: 674287-APP1$
USERPROFILE: C:\Windows\system32\config\systemprofile
windir: C:\Windows
ORIG_PATH_INFO: /site-login/core/settings/diagnostics/index.php
URL: /site-login/core/settings/diagnostics/index.php
SERVER_SOFTWARE: Microsoft-IIS/8.5
SERVER_PROTOCOL: HTTP/1.1
SERVER_PORT: 80
SERVER_NAME: xxxxxxxxxxxxxxxxxxxx.co.uk
SCRIPT_NAME: /site-login/core/settings/diagnostics/index.php
SCRIPT_FILENAME: C:\_WEBSITES\xxxxxxxxxx.co.uk\TEST\httpdocs\site-login\core\settings\diagnostics\index.php
REQUEST_URI: /site-login/core/settings/diagnostics/?extended
REQUEST_METHOD: GET
REMOTE_PORT: 50922
REMOTE_HOST: 217.146.106.109
REMOTE_ADDR: 217.146.106.109
QUERY_STRING: extended
PATH_TRANSLATED: C:\_WEBSITES\xxxxxxxxxx.co.uk\TEST\httpdocs\site-login\core\settings\diagnostics\index.php
LOCAL_ADDR: 192.168.100.153
INSTANCE_META_PATH: /LM/W3SVC/108
INSTANCE_NAME: XXXXXXXXX.CO.UK
INSTANCE_ID: 108
HTTPS: off
GATEWAY_INTERFACE: CGI/1.1
DOCUMENT_ROOT: C:\_WEBSITES\xxxxxxx.co.uk\TEST\httpdocs
APPL_PHYSICAL_PATH: C:\_WEBSITES\xxxxxxxx.co.uk\TEST\httpdocs\
APPL_MD_PATH: /LM/W3SVC/108/ROOT
IIS_UrlRewriteModule: 7.1.0761.0
WEBSOCKET_VERSION: 13
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36
HTTP_REFERER: https://xxxxxxxxxxxxxxxxx.co.uk/site-login/core/settings/diagnostics/
HTTP_HOST: xxxxxxxxxxxxxxxxxxx.co.uk
HTTP_COOKIE: cc_cookie_accept=cc_cookie_accept; cmsa=1; PHPSESSID=ps7bgkkelo64qjuu7fdopulpl6; _ga=GA1.3.338694577.1431946708; _gat=1
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate, sdch
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_CONNECTION: keep-alive
FCGI_ROLE: RESPONDER
PHP_SELF: /site-login/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1435310184.5935
REQUEST_TIME: 1435310184

And here is the template for the gallery image:

<perch:gallery id="image" type="image" key="main" />
<perch:gallery id="image" type="image" key="thumb" width="480" height="320" crop="true" />

<perch:gallery id="desc" type="textarea" label="Description" size="s" textile="true" editor="markitup" />

Thank you.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How big is your image? It looks like your max size is 2MB.

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Drew

Yes, I noticed that too. I tried it with an image of 29kb but to no avail. The same image uploaded fine through Assets though.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What type of image is it? What does the file name of the image look like?

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

I tried 2 normal jpg files. They both opened ok in other programs and the filenames were produce-lamb.jpg and produce-beef.jpg.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is there anything in your server error log?

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

I've just sent the client a request for the log file as I can't access that. Hopefully there will be something in there. I'll come back when I have it..

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Drew

Sorry for the delay, but I finally have the log file. There are many repeated errors (tried it multiple times) so here is a snippet of just one occurence.

[26-Jun-2015 08:59:16 UTC] PHP Notice:  Undefined index: albumID in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\upload.php on line 13
[26-Jun-2015 08:59:17 UTC] PHP Notice:  getimagesize(): Read error! in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 173
[26-Jun-2015 08:59:17 UTC] PHP Notice:  Undefined index: w in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 205
[26-Jun-2015 08:59:17 UTC] PHP Notice:  Undefined index: h in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 206
[26-Jun-2015 08:59:17 UTC] PHP Notice:  getimagesize(): Read error! in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\core\lib\PerchImage.class.php on line 66
[26-Jun-2015 08:59:17 UTC] PHP Notice:  getimagesize(): Read error! in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 173
[26-Jun-2015 08:59:17 UTC] PHP Notice:  Undefined index: w in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 205
[26-Jun-2015 08:59:17 UTC] PHP Notice:  Undefined index: h in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\addons\apps\perch_gallery\PerchGallery_Image.class.php on line 206
[26-Jun-2015 08:59:17 UTC] PHP Notice:  getimagesize(): Read error! in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\core\lib\PerchImage.class.php on line 66
[26-Jun-2015 08:59:17 UTC] PHP Notice:  getimagesize(): Read error! in C:\_WEBSITES\XXXX.co.uk\TEST\httpdocs\site-login\core\lib\PerchImage.class.php on line 66

As I said before, all image uploads are perfectly ok through Assets.

Thanks very much..

Drew McLellan

Drew McLellan 2638 points
Perch Support

It sounds like the image is being uploaded but then can't be read. Do you have control over the file permissions?

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

That's what I thought at first, but the image is on 0 bytes. Not sure if that means it made it or not.

I don't have direct access but the client is a software house so they are very good with these sorts of issues but unfortunately they don't do php or mysql. I do have full FTP access though.

What also puzzles me is that going through the Assets app, it works fine. I guess that means the gallery app handles certain bits differently as well as permissions (?)...if that is the cause of course..

Drew McLellan

Drew McLellan 2638 points
Perch Support

If the image has zero bytes then it wasn't uploaded - it's an empty file.

Has this problem been solved as I have the same issue?

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Hi Andy

Gosh, old thread this one!

Drew was spot on about permissions. The problem was the client insisted on hosting on a Windows server under IIS and it caused all sorts of issues. I'm not saying Windows Server and IIS are bad, but I don't know much about setting them up properly so they had to get someone in the know to sort it out.

Although it was a permissions issues, all I was told is that it wasn't a 'straight forward permissions issue'. The right users need the right permissions to all sorts of stuff.

Hi Michael,

Thanks for the prompt reply. I'm using Apache on CentOS so I'll have to try tweaking the permissions. The issue occurs on both my local VM and the remote server.

Michael Wilkinson

Michael Wilkinson 6 points
Registered Developer

Ah I see.

I would advise you start a new thread with the problem so Drew and Rachel can handle it as a separate issue. Don't forget, this has been marked as resolved so they may not even see it.

Hope you get it sorted.