Import existing image as a single post

See my answer here: The Media Library lives in both wp_posts and wp_postmeta. wp_postmeta contains the image URL wp_posts contains an entry for each image insertion into a post, along with the post ID. Exporting and importing these 2 tables as SQL did not work for me – I received ‘duplicate entry for key 7’… … Read more

Garbled HTML pulled for page description “caption id=attachment…”

That’s shortcode with the brackets stripped. And since shortcode is either rendered or removed before output, it suggests that these descriptions are not merely being “scraped” from your site, but provided by a WordPress plugin or locally-hosted script. I would first check your theme is not “leaking” raw shortcode; do you see something like [caption…] … Read more

WordPress Images | How to get the cropped image?

if you have the attachment (image) id, you ca use : wp_get_attachment_image_src( $attachment_id, $size); where $size is the smaller version you want. (see http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src) If you don’t know the attachment id you may query the database for full image size url : http://pippinsplugins.com/retrieve-attachment-id-from-image-url/

Show uploaded images in full size

WordPress creates 3 different sizes as far as my research goes. Read this on WP image handling -> http://www.studiograsshopper.ch/web-development/wordpress-featured-images-add_image_size-resizing-and-cropping-demo/ You can easily customise the default Media sizes by changing the default sizes in Dashboard > Settings > Media. You can grab any of those sizes. See the codex @ http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail The function you want is: … Read more

Uploading Full Size Image vs Resizing Before Upload

If your server has the right libraries the images are resized on upload so the public facing load time should not suffer. You can add image sizes with add_image_size and retrieve those specialize sizes with functions like get_the_post_thumbnail or get_attachment_image_src, among others. There are also a lot of post here about image sizes. You may … Read more

Post-upgrade problems: Image URL in DB, but not showing

I don’t have time to produce working code for this. I will edit the answer if I get the chance. In the meantime, you probably want a filter on upload_dir to alter that path. Your code would look something like this then: function alter_upload_wpse_107016($upload) { remove_filter(‘upload_dir’,’alter_upload_wpse_107016′); // alter $upload array return $upload; } if (1 … Read more

Post Images Size Change in WordPress

First of all set the image size in Settings > Media or seta customized image size using add_image_size function. New images you will upload will be right size, but for images already uploaded you have to recreate the image sizes, for the pourpose you can use the plugin Regenerate Thumbnails Hope it helps.

wp_get_attachment_image_src() does not return what I want

The following is entirely based on experiment over the last 15 minutes or so, so I wouldn’t call it canonical but … wp_get_attachment_image_src() uses the image_downsize() function, which will attempt to find and return the image closest in size to the supplied size values. If you experiment with know image sizes (look at the actual … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)