How to keep WP from recompressing Full Size images

Using a filter for jpg_quality will hellp you to set your quality for uplaoded images. add_filter(‘jpeg_quality’, create_function(‘$n’, ‘return 70;’)); In most good implementations of Image Optimization you can find a various usae of ImageOptimization tools such as optimng/jpegtran etc, there a lot of plugins that help you to do that.

Multiple images in one attachment page

An attachment page is dedicated to a single attachment media item (image, video, audio etc.). You can change it’s behaviour by editing single-attachment.php. However this is not recommended. It is possible to create galleries and insert them in posts. Or install a plugin that displays custom posts as galleries of images.

How can I attach hotlinked images in posts/pages within the same server?

No complete code, but I know you can stick it together. 🙂 Find all post IDs of unattached images (borrowed from wp-admin/upload.php): global $wpdb; $lost = $wpdb->get_col( ” SELECT ID FROM $wpdb->posts WHERE post_type=”attachment” AND post_parent > ‘0’ AND post_parent NOT IN ( SELECT ID FROM $wpdb->posts WHERE post_type NOT IN ( ‘attachment’, ‘” . … Read more

Out of memory error reporting

How do your users upload photos? You’re right about register_shutdown_function. It seems to work well in my code, though I only ever call my back-end via AJAX (I’ve also got file upload functionality), and so only need to account for this case. Here’s how I set it up in my plugin. Outside of the plugin … Read more

Extracting gallery images in WordPress 3.5 on index.php

get_the_content is a template tag and would only work reliably inside a Loop. That means that you should also be able to use the $post global instead. global $post; // may not be necessary unless you have scope issues // for example, this is inside a function $post_content = $post->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $array_id = … Read more

Pull Random Attachments With Pagination

Your since83_pagination() function is assuming the main query– $wp_query— but you are needing to paginate something very different. You need to be paginating the results in $attachments which you are retrieving with get_children(). That was my guess as soon as I saw this question. You are going to need to rethink this. There are two … Read more

Some images not found 404 in localhost

Changing the home and siteurl in your wp_options table is not enough unfortunately. You will still have your post content with your non-localhost URL (http://domain.com) causing your website to not display properly on your localhost. Once you’ve downloaded and imported your database to your localhost. Follow these steps: Go and download Interconnect IT’s Database Search … Read more

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