Hi
Guys I need to remove all images from the database.
This is because i want to show a default one if there are none specified.
I'm changing theme so I need to use different size images thus negating the need for the current one.
http://www.cfcnet.co.uk
to
http://server34.ipslink.com/~clubcfcn/cfcnet/
Images themselves are not kept in the database, they are usually in a sub-directory such as wp-content/uploads.
Now the wp_posts table contains references to images and those records have a post_type of "attachment".
can a default image be shown if an image is not found?
@MichaelH
I also want to know the same. Is there any entry in the database for images?? Except that you have mentioned..
CFCnet,
What you need is a php if statement to determine if the image exists. Try something like this to get started. This assumes that you are looking for an image in a custom field and the determines if custom field is empty.
<?php if( get_post_meta($post->ID, 'customFieldName', true) ) { ?>
<img src="<?php bloginfo('url'); ?>/wp-content/uploads/<?php echo get_post_meta($post->ID, 'customFieldName', $single=true) ?>">
<?php } else { ?>
<img src="path/to/default/image.jpg">
<?php } ?>