Forum

Thread tagged as: Problem

unable to add assets

I was able to add assets to developing site just fine. Uploaded the site to staging. Now I can't add assets to either the development site or the staging site. Trying to figure out what I did to cause this. Resources folder at staging is coded "755" -- what I need to be editable. Resources folder locally is "Read & Write" -- also what I need.

Diagnostics code from the staging site is below:

HEALTH CHECK

Perch is out of date. You are running Perch 2.8.4 and the latest is 2.8.5. Update instructions
PHP 5.3.13 is very out of date. More info
MySQL 5.5.32-log is up to date
Image processing available
Memory limit is low. Memory use is limited to 32M, which could cause problems manipulating large images.
SUMMARY INFORMATION

Perch: 2.8.4, PHP: 5.3.13, MySQL: 5.0.51a, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.4), assets (2.8.4), categories (2.8.4), perch_forms (1.8.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /hermes/waloraweb055/b1771/moo.sevaakcom/organic/perch
PERCH_CORE: /hermes/waloraweb055/b1771/moo.sevaakcom/organic/perch/core
PERCH_RESFILEPATH: /hermes/waloraweb055/b1771/moo.sevaakcom/organic/perch/resources
Image manipulation: GD
PHP limits: Max upload 20M, Max POST 20M, Memory: 32M, Total max file upload: 20M
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
DOCUMENT_ROOT: /home/users/web/b1771/moo.sevaakcom/organic
REQUEST_URI: /perch/core/settings/diagnostics/
HTTP_HOST: www.organic.sevaak.com

I'm running php 5.6.1 locally in development. Remote staging is 5.3.1 but I can ask the host to update if necessary.

I've never run into this problem before so I'm stumped.

Thanks for your help!

Kimberly Olmsted

Kimberly Olmsted 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you get any errors, or anything logged in your server error log?

What changed on the staging site between it working and not working?

My error log on the remote server is empty.

"What changed on the staging site between it working and not working?" -- That's the $64 dollar question which I am trying to figure out. Have cleared the decks and am once more going through everything with a fine tooth comb to see if I can figure that out.

Just thought you might have an idea. Usually when I screw up it's something very simple to fix.

A bit more information:

I can "successfully" drag files into the asset window locally. I say "successfully" because while they don't show in the asset window after being dragged there, they DO appear in the Perch/Resources folder -- in Perch's two versions - original size and thumb size.

I cannot do this same thing on the staging site on the remote server.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, let me know what you find out.

I still haven't found the problem but when when I turned on the debug I got this message (which I don't understand):

Debug Message SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0 Queries: 1 Memory: 1.4677

Is that helpful?

And more fully from the Settings / Diagnostics:


Debug Message SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='3216ea42db040559585056454676d151' LIMIT 1 UPDATE perch2_users SET userHash='bfe7658822cd5da48efa6c0f3a1b0c12' WHERE userID=1 SELECT p.privKey FROM perch2_user_privileges p SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID Queries: 5 Memory: 1.8608
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is that when uploading a new image through Assets or somewhere else?

I'm not exactly sure what your "is that" is referring to so I'll try to cover all bases:

The debug message occurs when I first log into the Perch CMS Admin locally. The extended debug comes from the Settings / Diagnostics window.

My ability to load images (getting them to the Resources folder but not appearing on the page) occurs when loading assets from a template form on the page in the Admin window. Here is the code for the template:

<img src="<perch:content type="image" id="photo" label="Photo (200px width x 300px height)" bucket="boutiqueslideshow" alt="slide show images"/>"/>   

It is the same code that has worked on other Perch sites for me.

When I attempt to load assets in this way they appear momentarily in the assets window but then I receive the warning "No matching assets found" and they disappear. They DO appear in the Resources folder though so it seems to be "half" working.

Just now I tried adding images from the Asset window. That worked and from the page I was able to pull them into my admin template form. However, because they were pulled in this way they do not have a Bucket associated with them and that would make adding an asset for the client rather cumbersome. I was only able to access them by pulling up all jpg images -- not via a bucket filter.

I hope this last exercise is helpful in figuring out the difference.

The only thing I can think of that I did between the files working well with assets and the files not working was that I added Open Graph meta in the head of the files -- manually -- not through Perch's OG process.

Thanks for your help Drew.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm talking about the last post - the debug information. Where is it from?

It's from the Perch Admin window Settings / Diagnostics -- on the local developing site.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post the debug after the upload?

Sure. Here is the short form:

Debug Message
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Queries: 1
Memory: 1.4652

and here is the extended from Settings / Diagnostics:

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='10e2c0a31a459add31ac0533d5e72d38' LIMIT 1
UPDATE perch2_users SET userHash='384f22bfdd27bd9e1737cca4903688bc' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT *, REPLACE(pagePath, '/index.php', '') as sortPath FROM perch2_pages WHERE pageNew=1 ORDER BY LENGTH(sortPath)-LENGTH(REPLACE(sortPath, '/', '')) ASC
SELECT p.*, (SELECT COUNT(*) FROM perch2_pages WHERE pageParentID=p.pageID) AS subpages FROM perch2_pages p WHERE p.pageParentID IN (0) ORDER BY p.pageTreePosition ASC
SELECT * FROM perch2_content_regions ORDER BY regionOrder ASC
SELECT * FROM perch2_content_regions WHERE regionPage='*'
SELECT DISTINCT regionTemplate FROM perch2_content_regions ORDER BY regionTemplate ASC
Queries: 10
Memory: 2.4444
Drew McLellan

Drew McLellan 2638 points
Perch Support

So if you go to Assets, click on an image, and then upload a replacement file, what does it output at the bottom of that same edit page immediately at that point?

This before submitting:


Debug Message SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='d5a59a45aee78123af3d7bf27f727240' LIMIT 1 UPDATE perch2_users SET userHash='e849cb72bac3da1e56ec45fe224b72ac' WHERE userID=1 SELECT p.privKey FROM perch2_user_privileges p SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID SELECT * FROM perch2_resources WHERE resourceID=65 LIMIT 1 SELECT COUNT(*) FROM perch2_resource_log WHERE resourceID='65' Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seva_db.perch2_resource_log' doesn't exist SELECT * FROM perch2_resources WHERE resourceParentID='65' AND resourceKey='thumb' SELECT * FROM perch2_resources WHERE resourceID='65' LIMIT 1 SELECT t.* FROM perch2_resource_tags t, perch2_resources_to_tags r2t WHERE t.tagID=r2t.tagID AND r2t.resourceID='65' Queries: 9 Memory: 2.722

And this immediately after submitting:

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='5c385ea3a137836418abf407539c5eed' LIMIT 1
UPDATE perch2_users SET userHash='40911f453c18d9e9c4edd874f5e681a4' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * FROM perch2_resources WHERE resourceID=65 LIMIT 1
Resizing image... (gd, w150 h150 @2x thumb)
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceFileSize,resourceWidth,resourceHeight,resourceMimeType,resourceTitle) VALUES('content','default','skincando-hires.jpg','orig',0,'jpg','2015-04-23 04:55:23','0',63061,970,258,'image/jpeg','Skincando hiRes')
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceWidth,resourceHeight,resourceTargetWidth,resourceTargetHeight,resourceDensity,resourceFileSize,resourceMimeType,resourceTitle) VALUES('content','default','skincando-hires-thumb@2x.jpg','thumb','67','jpg','2015-04-23 04:55:23','0',150,39,150,150,2,4719,'image/jpeg','Skincando hiRes')
SELECT * FROM perch2_resources WHERE resourceID='67' LIMIT 1
UPDATE perch2_resources SET resourceTitle='Jewlry2', resourceInLibrary=0 WHERE resourceID=67
Setting alert: Successfully updated (success)
SELECT COUNT(*) FROM perch2_resource_log WHERE resourceID='67'
Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seva_db.perch2_resource_log' doesn't exist
SELECT * FROM perch2_resources WHERE resourceParentID='67' AND resourceKey='thumb'
SELECT * FROM perch2_resources WHERE resourceID='67' LIMIT 1
SELECT t.* FROM perch2_resource_tags t, perch2_resources_to_tags r2t WHERE t.tagID=r2t.tagID AND r2t.resourceID='67'
Queries: 14
Memory: 4.2659
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah ha:

Base table or view not found: 1146 Table 'seva_db.perch2_resource_log' doesn't exist

Can you visit:

/perch/core/update/?force=update

I did that and it made the images appear on the developing site page. Thank you for this step!

I next went into the admin and tried to upload an asset from the page and this was still unsuccessful. What is the next step? Did I jump the gun?

And -- at some point (after this is resolved) -- could you share your thoughts on how this might have happened and how to avoid it in the future?

Thanks Drew!

Here's the debug message after I tried a couple of times to upload an image from the admin page (not assets) and then deleted the item.

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='0f8fd1e21c6ff818ab369e781c92ded4' LIMIT 1
UPDATE perch2_users SET userHash='061f0d1c3fdc378f533c6dffda7d6667' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * FROM perch2_content_regions WHERE regionID=50 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='4' LIMIT 1
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=12 ORDER BY itemOrder ASC
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=12 ORDER BY itemOrder ASC
Using template: /templates/content/boutique-slide-show.html
INSERT INTO perch2_content_items (itemID, regionID, pageID, itemRev, itemOrder, itemJSON, itemSearch, itemUpdatedBy) SELECT itemID, regionID, pageID, 13 AS itemRev, itemOrder, itemJSON, itemSearch, 1 AS itemUpdatedBy FROM perch2_content_items WHERE regionID=50 AND itemRev=12 ORDER BY itemOrder ASC
REPLACE INTO perch2_resource_log (appID, itemFK, itemRowID, resourceID) SELECT cr.appID, cr.itemFK, c2.itemRowID, cr.resourceID FROM perch2_resource_log cr, perch2_content_items c1, perch2_content_items c2 WHERE cr.appID='content' AND cr.itemFK='itemRowID' AND cr.itemRowID=c1.itemRowID AND c1.itemID = c2.itemID AND c1.regionID=50 AND c2.regionID=50 AND c1.itemRev = 12 AND c2.itemRev = 13
SELECT itemRowID FROM perch2_content_items WHERE regionID=50 AND itemRev=13 ORDER BY itemOrder ASC
UPDATE perch2_content_items SET itemOrder=1000 WHERE itemRowID='609'
UPDATE perch2_content_items SET itemOrder=1001 WHERE itemRowID='610'
UPDATE perch2_content_regions SET regionLatestRev=13 WHERE regionID=50
SELECT regionRev FROM perch2_content_regions WHERE regionID=50
DELETE FROM perch2_content_items WHERE regionID=50 AND itemRev!=12 AND itemRev IN (SELECT itemRev FROM (SELECT DISTINCT itemRev FROM perch2_content_items WHERE regionID=50 ORDER BY itemRev DESC LIMIT 8, 99999) AS t2)
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID NOT IN (SELECT itemRowID FROM perch2_content_items)
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=13 ORDER BY itemOrder ASC
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='609'
SELECT * FROM perch2_resources WHERE resourceID='65' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='65' AND resourceKey='thumb'
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',609,65),('content','itemRowID',609,66),('content','itemRowID',609,73),('content','itemRowID',609,74)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"107\",\"photo\":{\"assetID\":\"65\",\"title\":\"Jewlry2\",\"_default\":\"\\/perch\\/resources\\/jewlry2.jpg\",\"bucket\":\"default\",\"path\":\"jewlry2.jpg\",\"size\":14320,\"w\":200,\"h\":300,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"100\",\"h\":\"150\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"jewlry2-thumb@2x.jpg\",\"size\":12279,\"mime\":\"\",\"assetID\":\"66\"}}}}', itemSearch=' ' WHERE itemRowID=609
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='610'
SELECT * FROM perch2_resources WHERE resourceID='59' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='59' AND resourceKey='thumb'
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',610,59),('content','itemRowID',610,60)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"108\",\"photo\":{\"assetID\":\"59\",\"title\":\"Hat1\",\"_default\":\"\\/perch\\/resources\\/hat1.jpg\",\"bucket\":\"default\",\"path\":\"hat1.jpg\",\"size\":14253,\"w\":200,\"h\":300,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"100\",\"h\":\"150\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"hat1-thumb@2x.jpg\",\"size\":12655,\"mime\":\"\",\"assetID\":\"60\"}}}}', itemSearch=' ' WHERE itemRowID=610
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=13 ORDER BY itemOrder ASC
Using template: /templates/content/boutique-slide-show.html
UPDATE perch2_content_regions SET regionHTML='<img src=\"/perch/resources/jewlry2.jpg\"/> <img src=\"/perch/resources/hat1.jpg\"/> ', regionRev=13, regionLatestRev=13 WHERE regionID=50
Setting alert: Content successfully updated (success)
SELECT * FROM perch2_resources WHERE resourceApp='content' AND resourceInLibrary=0 AND resourceCreated<'2015-04-22 15:33:33' AND resourceID NOT IN (SELECT resourceID FROM perch2_resource_log)
SELECT MIN(itemRev) FROM perch2_content_items WHERE regionID=50
DELETE FROM perch2_content_index WHERE regionID=50 AND itemRev<6
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=13 ORDER BY itemOrder ASC
DELETE FROM perch2_content_index WHERE regionID=50 AND itemRev=13
Using template: /templates/content/boutique-slide-show.html
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (107,50,4,13,'photo','/perch/resources/jewlry2.jpg'),(107,50,4,13,'_id',107),(107,50,4,13,'_order','1000')
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (108,50,4,13,'photo','/perch/resources/hat1.jpg'),(108,50,4,13,'_id',108),(108,50,4,13,'_order','1001')
OPTIMIZE TABLE perch2_content_index
UPDATE perch2_pages SET pageModified='2015-04-23 15:33:34' WHERE pageID=4
SELECT * FROM perch2_content_items WHERE regionID=50 AND itemRev=13 ORDER BY itemOrder ASC
Queries: 54
Memory: 3.9081

Drew McLellan

Drew McLellan 2638 points
Perch Support

How is it failing at this point? Everything looks good in the debug.

I am still not able to upload images from the page in the CMS Admin.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What do you see when you try? What does it look like from a UI point of view?

The image appears VERY BRIEFLY in the drag in window (I have tried dragging the file in and selecting the file -- no difference) and then disappears.

The message "No matching assets found" appears below the drag in window.

I'm sorry this is taking so long Drew. Many, many thanks for your perseverance.