wordpress-heroku icon indicating copy to clipboard operation
wordpress-heroku copied to clipboard

Can't add images to an image gallery

Open mdoerneman opened this issue 12 years ago • 13 comments

After selecting images for an image gallery and saving, when re-opening the image gallery it is empty. I tested on a default wordpress installation and it works fine.

mdoerneman avatar Feb 22 '13 21:02 mdoerneman

Make sure to have an AWS S3 account with credentials setup.

mhoofman avatar Feb 24 '13 21:02 mhoofman

I had this problem with an invalid bucket-name.

kristoffernolgren avatar Feb 25 '13 16:02 kristoffernolgren

I'm seeing a similar issue, but I've confirmed my S3 setup (for example, I can upload media to S3 and then insert it directly into pages). However, putting images into a gallery and then saving leaves an empty gallery when I try to edit it again; the images also don't show up on the page.

liujimj avatar Mar 05 '13 06:03 liujimj

So on further reflection, the NextGen gallery plugin doesn't work either, because it tries to write locally.

I'm aware that I can run MAMP locally get the plugin and galleries running, but is there a better solution? Seems odd to split content editing (gallery vs. posts/pages) between local and production, unless there's a good way to sync the local PostGres to prod.

liujimj avatar Mar 05 '13 06:03 liujimj

I have also confirmed my S3 setup. Is there no solution to this?

mdoerneman avatar Mar 27 '13 03:03 mdoerneman

It looks like it may be a compatibility issue with Postgresql for Wordpress: http://wordpress.org/support/topic/possible-nextgen-gallery-compatibility-issue

mdoerneman avatar Mar 27 '13 11:03 mdoerneman

I have the same problem, I think it's because of a bad PostgreSQL query. When I click on the "create gallery" button, I get the following error in the logs:

WordPress database error ERROR: column p.id does not exist\nLINE 1: SELECT p.id FROM wp_posts AS p WHERE p.post_date > '2013-03...\n ^ for query SELECT p.id FROM wp_posts AS p WHERE p.post_date > '2013-03-24 16:12:24' AND p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_date ASC LIMIT 1

To solve this problem, I replaced p.id by p.ID in the file "wp-includes/link-template.php" at line 1177. The query is now valid, but I get a second error with the query below:

WordPress database error ERROR: function field(bigint, integer, integer) does not exist\nLINE 1: ... AND (wp_posts.post_status = 'inherit') ORDER BY FIELD( wp_...\n ^\nHINT: No function matches the given name and argument types. You might need to add explicit type casts. for query SELECT wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (563,562) AND (wp_posts.post_mime_type LIKE 'image/%') AND wp_posts.post_type = 'attachment' AND (wp_posts.post_status = 'inherit') ORDER BY FIELD( wp_posts.ID, 563,562 ) LIMIT 0, 2 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyten/page.php'), get_template_part, locate_template, load_template, require('/themes/twentyten/loop-page.php'), the_content, apply_filters('the_content'), call_user_func_array, do_shortcode, preg_replace_callback, do_

It seems that PostgreSQL does not recognize the ORDER BY FIELD. I did not find in the code where is the declaration of this query.

dz0rg avatar Apr 20 '13 10:04 dz0rg

I don't know if it's related but I saw similar problems not using NextGen but the plain WP gallery + Cloudinary. The problem was solved for me by fixing the syntax of the gallery shortcode. What it generates by default is something like

[gallery ids="1,2,3,4,5"]

whereas it should be

[gallery include="1,2,3,4,5"]

Once I made this change the galleries seemed fine. Don't know if this is a bug in this version of wordpress or what.

ericgj avatar May 02 '13 22:05 ericgj

@ericgj Where did you made the changes to fix this "ids"vs "include" issue?

bruno-rodrigues avatar Aug 05 '14 14:08 bruno-rodrigues

No memory of this, sorry...! But it looks like it would be in the "text" or "source" view of the WP editor.

ericgj avatar Aug 05 '14 20:08 ericgj

What I want is to change from ids to include programmatically, I already did it manually on "text tab".

bruno-rodrigues avatar Aug 05 '14 23:08 bruno-rodrigues

@ericgj That solution of switching from ids to include worked for me too.

miken avatar Oct 17 '14 00:10 miken

I have this same problem, but using Gallery field from Advanced Custom Fields PRO. This is what I get: WordPress database error: [ERRORE: la funzione field(bigint, integer) non esiste LINE 1: ... wp_posts.post_status <> 'auto-draft')) ORDER BY FIELD( wp_... ^ HINT: Nessuna funzione trovata con nome e tipi di argomenti forniti. Potrebbe essere necessario convertire i tipi esplicitamente.] SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (902) AND wp_posts.post_type = 'attachment' AND ((wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft')) ORDER BY FIELD( wp_posts.ID, 902 )

How can I solve this? At least where is located the query, so I can attempt to modify it directly and test if it works? Any help will be greatly appreciated! 👍

cR0Ckr0x avatar Dec 16 '16 15:12 cR0Ckr0x