Tag Info

New answers tagged

-1

Set allow_all_external_sites=true in your timthumb.php file in the particular plugin.


3

Image sizes are generated when the original is uploaded. If you add an image size after files have already been uploaded, those old images won't have the new sizes, and will default to displaying the original. If you search the WordPress Plugin repository for "regenerate images" you'll find some plugins that will simplify fixing this.


0

You need only to save generated file in the upload folder!... Use php. If you need to add this file in Media libary than use wp_insert_attachment()


0

This is something that I've been working on as a core enhancement to WordPress. It's a bit of a windy road to get it done. However, in the interim, there's a plugin approach you can take that allows you to specify the crop for any of the custom image sizes that you may have defined. Follow this ticket: https://core.trac.wordpress.org/ticket/30062 to learn ...


1

Reason was simple: "wp-plugin-in-github" tool has not any delete assets functions. So in git repo there were no screenshot-1.png, but in svn repo — it was. See: https://github.com/sudar/wp-plugin-in-github/blob/e5a004052342cbdfc5bd7fbcb844fffce8695f91/deploy-plugin.sh#L231 Workaround to work: find $SVNPATH_ASSETS -type f -not -path '*.svn*' -delete cp ...


1

yes, the naming convention for resized images is name-{width}x{height}.extension. Is it good enough info to base a regex on? in practice most likely yes, but in theory no. You just can't know if mark-20x20.jpg was not simply uploaded that way, and even in places where you know that a resized image should be used you have no way to know if wordpress had ...


0

Thanks again for your efforts, Dan. FYI, I got an answer which I put below. The taxonomy terms I used were: "greencheck" and "redx". I used the same 3 terms in 3 different taxonomies and it seems to work OK. /CSS edits/ .greencheck{ background: url(http://example.com/wp-content/themes/news-pro/images/greencheckmark-41x36.png); width: 30px; height: 30px; ...


0

Please set maximum execution time like below : 1 - Modify your php.ini file and set ini_set('max_execution_time', 150); OR 2 - Modify your site root .htaccess file and set php_value max_execution_time 150 Note : you can extend it as per your need. Here 150 means 2.5 minutes.


0

It seems that there is problem with your image thumbnail. May be it doesn't exists. You can fix this by instaling Regenerate thumbnails plugin. Then generate thumbnails for all media files. Another way is to include image in post or page with full url. You can do this by selecting image size to "Full Size" in Attachment Display Settings in media uploader ...


0

hey dude is much easy i solve your problem open functions.php file and add this code for medium crop large crop. if(false === get_option("medium_crop")) { add_option("medium_crop", "1"); } else { update_option("medium_crop", "1"); } here is reference link ...


0

Look at this answer by Chip Bennet - Medium / Large images sizes aren't cropped by default ( and I also just verified on my install ). You can change the cropping of Thumbnails in Settings -> Media. It sounds like what you really need is just a new image size via add_image_size() which is also described in his answer. As far as removing unused images, ...


0

Alright, here is code for having wordpress pages redraw an image on a page as new images are detected (like for a directory that a web cam automatically uploads images to). It assumes the following: You are using PHP 5.3 or higher (easily modified to not require it though) You have your web cam images uploading somewhere reachable directly via the web You ...


0

I found what I needed: $category = get_category( get_query_var( 'cat' ) ); $cat_id = $category->cat_ID; $images = get_posts( array('post_type' => 'attachment', 'category__in' => $cat_id)); if ( !empty($images) ) { foreach ( $images as $image ) { $image_url = $image->guid; } } else{ $image_url = ''; } First I got the ...


0

wp_get_attachment_image_src returns an array with 3 elements; the image URL, the width, and the height. You need to echo the first index of the result. In fact, you can make your code a little leaner by using a foreach loop: foreach ( $images as $i => $image ) { $src = wp_get_attachment_image_src( $image->ID, 'full' ); echo '<img ...


0

Well it turns out that the reason has_post_thumbnail() was failing was because get_post_meta() was returning empty for scheduled posts. I'm still not sure why, but in case someone else has the issue, my workaround was to create a new function to fetch the featured image ID without relying on get_post_meta(): function get_featured_image_id($postID) { ...


0

I found a solution, but it seems rather cumbersome. I would think a cleaner solution would be possible using WP’s native thumbnail functions, but I can’t figure it out. When I use the “tribe_event_featured_image” function, it replaces the images well wherever that function is loaded in the templates. However, I also use for example the Genesis Framework and ...


0

Well I add my piece by saying that I'm a beginning wordpress user, and for particularly my portfolio. I have the same responsive image issue, where in the HTML/CSS prototype images say like portfolio piece was like "1000x650" and it scaled. However, in wordpress that didn't work. So I googled and found the original poster of this issue actually worked for ...


2

You can try the image_send_to_editor filter: /** * Wrap the inserted image html with <figure> * if the theme supports html5 and the current image has no caption: */ add_filter( 'image_send_to_editor', function( $html, $id, $caption, $title, $align, $url, $size, $alt ) { if( current_theme_supports( 'html5' ) && ! ...


0

I think you given like echo the_post_thumbnail($post_id); No need of giving echo if we are using the_post_thumbnail().It by default echoing the result.So here, it will display the image twice. If we use get_the_post_thumbnail(), then echo is needed. So use either echo get_the_post_thumbnail(); or the_post_thumbnail(); Try this..


4

WP sanitize_file_name() function doesn't handle those characters by default. You can add filter and sanitize those to avoid encoding issues. function mamaduka_sanitize_file_name( $filename ) { $filename = strtr($filename, ...


0

I took a quick look at the Modern Tribe's source code, particularly the single-event.php view template. MT is using an internal function, tribe_event_featured_image(), which includes a filter: tribe_event_featured_image. You could use this filter to see if MT has already found an image, and, if not, look up your own and return its value. add_filter( ...


-2

Its too much simple while (have_posts()) : the_post(); if (has_post_thumbnail($post->ID)) { $featuredImage = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID,'full')); echo $featuredImage; } }


1

The code you provided could cause issues with 3rd party URLs in hyperlinks not running https. You can fix this by including your home url, e.g: $content = str_replace( set_url_scheme( home_url(), 'http' ), set_url_scheme( home_url(), 'relative' ), $content); Next, you're applying this when you'd like to display the content, which means you need to do an ...


1

I can tell how to do it with WordPress functions, which is quite easy and you won't lose any important stuff: Upload the default.jpg image using WordPress media manager. Note the ID of the image. Get all posts from your custom post type and run set_post_thumbnail() for each one. Example: add this code to functions.php of your theme or in a plugin. Visit ...


0

In the answers to this forum post is mentioned that $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); will get the job done for you. Maybe you should give that a try and look at the further information there.


0

In a normal post when you add an image, the WordPress editor adds the title to the img tag, not to the surrounding a tag. If both tags had different titles the title of the img tag would be displayed by the browser, not the title of the a tag. Using your original example, I have added a title attribute to the img tag: <a href="path_to_files/image.jpg" ...


2

First you need to get your attached image ID, how you get it depends on how you're setting the image. The generic idea is that you get the attachment ID then you can simply use get_the_title( $attachment_id ). If you're setting it as a Featured Image ( Post Thumbnail ) then you can use the following function to get the image ID: get_post_thumbnail_id( ...


0

As I can see they comepletly changed background image ( or image ) select in customizer. There's no more tabs for images at all. But what can you do is create new class wich will extend WP_Customize_Image_Control ( or WP_Customize_Upload_Control ) and add there a choise ( select or radio ) to show upload or sellect pattern. May be it can be compleated ...


1

You can use "rilwis/meta-box " for this . For dynamic slider use this snippet, <?php $images = rwmb_meta( 'gallery', 'type=image' ); foreach ( $images as $image ) { echo "<a href='{$image['']}' title='{$image['title']}' rel='thickbox'><img src='{$image['full_url']}' alt='{$image['alt']}' /></a>"; } ...



Top 50 recent answers are included