0

I'm making a site for a client which has about two thousand news entries that were imported from a WordPress installation, each entry is using a channel images field. However some entries are missing an image that needs to be uploaded. Is it possible to somehow write a query that would list titles or entry ids of entries that are currently missing an image? It's a pain to go through them all by hand.

Normally it's not a problem to just list entry titles where a certain field is empty but channel images uses a separate table

0

You could make an EE template with simple channel:entries loop and a conditional to see if the field is empty. If empty, print entry name, ID, whatever:

{exp:channel:entries} {if thumbnail == ""} {title} {/if} {/exp:channel:entries}

In this example thumbnail is the name of the channel images field.

| improve this answer | |
  • thanks, it never occurred to me to just check with a simple conditional. I found out that channel images has a {if image:no_images} conditional that I can use...found out all the missing images now :) – Dovla Jan 27 '14 at 8:25
0

Assuming you are looking for entries where no images have been added to the Channel Images field...

All you would have to do is query exp_channel_data where field_id_X is empty (with field_id_X as the Channel Images field). Even though Channel Images data is in another table, there is a marker in exp_channel_data when the field is not empty.

This isn't tested with the very latest version of Channel Images, but for previous versions this works for me:

SELECT entry_id 
FROM exp_channel_data
WHERE field_id_65 = ''
AND channel_id = '9'

Just update your field_id as appropriate for your Channel Images field and update the channel_id to match the channel of interest.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.