My image return to broken images… When i uploading a image, with dynamic image resizer plugin active on my plugin list..
]]>This modification adds several suggestions from previous posters and additionally extends the plugin functionality.
Default behaviour of WP:
When a new (custom) image size is added (e.g. with function add_image_size()) or an existing image size is changed this affects only images uploded after that change.
New feature:
The meta data for intermediate image sizes for already uploaded images is created on the fly. No plugins like “AJAX Thumbnail Rebuild” are necessary any more to display old images with new sizes.
List of changes:
Currently the modified version contains three define statements which can be used to enable the new features. See the script source at the beginning. In a future version this may be changed to become regular plugin options.
You need to set two of the defines in the script source to true, to enable the new feature:
define('DYNIMG_CREATE_IMAGE_FOR_ADDED_SIZE_ALWAYS', true);
define('DYNIMG_CREATE_IMAGE_FOR_CHANGED_SIZE_ALWAYS', true);
Download from https://gist.github.com/jotazzu/6940499
]]>Some of the calls like image_resize
are deprecated in favor of WP_Image_Editor.
I updated your plugin to reflect these changes, let me know if you’re interested.
]]>Plugin works great but we didn’t want to change the filename convention by adding a “c” for cropped images.
The solution:
1) Remove the “c” from filenames
(lines 32 and 82 remove: if ($size['crop']) $suffix .='c';)
2) Set crop to true
(line 22: $crop = true;)
The joke: In WP metadata the accurate width x height is already calculated for each image format, so when you autogenerate the image later on it doesn’t matter if you crop. if you crop a non-crop image you’ll simply crop nothing …
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Using plugin version 1.0 with WordPress 3.5.2 was serving up corrupted images – I traced it to WordPress having erroneous things in the output buffer. Also the plugin didn’t change the status code to 200 (instead it was left at 404, not really a critical problem though).
Solution was to change the end of the dynimg_404_handler() function to look like this:
// serve the image this one time (next time the webserver will do it for us)
header_remove();
flush();
ob_end_clean();
status_header( '200' );
header( 'Content-Type: '.$type );
header( 'Content-Length: ' . filesize($resized) );
readfile($resized);
exit;
Also, WordPress now has the image_resize function listed as deprecated, so I updated that section as well:
if ( file_exists($basefile) ) {
// we have the file, so call the wp function to actually resize the image
//OLD function $resized = image_resize($basefile, $width, $height, $crop, $suffix);
$editor = wp_get_image_editor( $basefile );
$editor->set_quality( 90 );
$resized = $editor->resize( $width, $height, $crop );
if ( is_wp_error( $resized ) )
return $resized;
$dest_file = $editor->generate_filename( $suffix, null );
$editor->save( $dest_file );
$resized = $dest_file;
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>I fixed it by adding the extension to :
if (preg_match('/(.*)-([0-9]+)x([0-9]+)(c)?\.(jpg|jpeg|png|gif)/i',$_SERVER['REQUEST_URI'],$matches)) {
In the line 19 of dynamic-image-resizer/dynamic-image-resizer.php
I also found and solved an issue with my nginx configuration, that might be useful in the documentation of your plugin.
Do you have a git repo where I can offer you contributions?
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>I wonder what will happen to images posted while the pluing was active, if the plugin is deactivated after being used for a while – will WP regenerate those images “dynamically” since it won’t find them or will there be an Error?
Would you need an option to manually generate all images in batches? This could also be usefull if one needs to deactivate the plugin for some reason temporarily without affecting the site.
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Images uploaded directly into media-library (not “Add Media” button) then attached to a Post, can thus have 2 thumbs because it will create a thumb with the letter ‘c’ (for cropped thumbs) and plugins I have like the “Portfolio Slideshow Pro” and “Background Manager” request a thumb without letter ‘c’, so now I have “Double Thumbs”.
However, if I upload using the “Add Media” button, there is no thumb file created until it is requested, which is fine, but the requested files (which is automatically generated) from my plugins above dont’t have letter ‘c’ for cropped thumbs. Thus if later the original original image is deleted the Thumb wihout ‘c’ is NOT deleted leaving “Orphan Thumbs” around on the server.
Can there be an option in settings somewhere to just use the standard name for cropped images? This would solve the problem I’m seeing.
Can you also add an option to manually generate all images in batches? This could also be usefull.
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>hi author.
this plugin is amazing and works great but after i active it i cant upload another file formats anymore.
for example when i try to upload a PDF file my uploading process bar still working for ever and i must refresh the page to see my new uploaded file.
i cant remove plugin because i really need it and i’m search for a way to except other formats in plugin base.
can you help me please?
i just want a simple exception in plugin file to not make tribulation with another file formats.
regards
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>I really hope so because my theme uses tinthumb which automatically generates bad crops of my featured images that are displayed in the blogroll page and they are less than appealing. I need a plugin that will allow me to specify which version of the image goes where. please let me know and thanks!
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hello!
Thanks again for a great plugin, however I’ve stumbled upon another issue. If I upload an image that has a resolution of 1280×800 and then register a post type, like this in my functions.php:
add_image_size('gallery-small', 280, 260, true);
And call it with the following code in my loop:
the_post_thumbnail('gallery-small');
It serves me the full-size image, and it doesn’t dynamically create the small size like it should. I’ve come across this as several sites that I coded recently. I’m thinking that it’s something that happened due to a recent WordPress update, but I’m guessing it would be easy to fix.
Thanks in advance,
Jonathan
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hello!
Thanks for a great plugin, however I have found a bug which I find quite annoying. I’ve coded a plugin which utilizes ffmpeg to encode videos to ogv/mp4 through the media uploader but your plugin keeps recognizing these files as images.
What happens is that is tries to generate sizes for my videos, resulting in a crash and an error message through the media uploader. This in turn renders my plugin unusable and I have to disable Dynamic Image Resizer while uploading a video.
I’ve tried to patch it myself but I didn’t want to mess with your code too much. Could you please look into this issue and try to make sure the plugin only runs when the uploaded file is indeed an image?
Thanks in advance,
Jonathan
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>I installed the plugin but it just doesn’t seem to attempt to generate the images, I just get a page not found.
Can this possibly be something to do with the script not being able to override the 404?
Is there any way I can debug this?
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Below is some code I’ve used to update old images to work with this plugin. This is only necessary if you’ve added or changed image sizes after some images were originally uploaded. It re-writes the metadata for image attachments, thus activating the plugin’s hook in wp_update_attachment_metadata that does all the magic.
// UPDATE OLD IMAGES FOR DYNAMIC RESIZING
// Necessary if you've added or changed image sizes
// May require you pump up your memory_limit & max_execution_time in php.ini if you have lots of image files...
function makeimagesresizable() {
global $dynimg_image_sizes, $_wp_additional_image_sizes;
$dynimg_image_sizes = $_wp_additional_image_sizes; // I think its necessary to fill this global used in DynImgResize? Maybe not
require ( ABSPATH . 'wp-admin/includes/image.php' ); // Neccesary for wp_generate_metadata (not always)
$images = get_children( 'post_type=attachment&post_mime_type=image&numberposts=-1&order=DESC&orderby=menu_order&post_parent=' ); // All images
foreach($images as $i){
$data = wp_generate_attachment_metadata($i->ID,$i->guid);
wp_update_attachment_metadata($i->ID,$data); // DynImgResize has a hook in this function that adds the data for not-yet-existant image files
echo $i->ID." : ".$i->guid."<br/>";
}
}
(^ This can probably be improved… Just offering it up if it might help someone out in the future. Amazingly useful plugin.)
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>This plugin is amazingly helpful!
I’m noticing that images with extension “.jpeg” are not being automatically resized (but when renamed to “.jpg” and re-uploaded they work fine)… I am trying to get a ton of old images to work with this plugin, and this is the final bump in the road – Any thoughts on how to do this without doing some insane find and replace in the database and filenames? Thanks
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Does this plugin works in buddypress ???
thank you
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>I really like this plugin and it does exactly what I need.
However when I altered the default image upload path and corresponding full URL (Settings > Media Settings) I get a Server 500 error when requesting a resized image on the fly.
Note – in the Media Settings screen the new upload path I’ve chosen is outside the wordpress install directory (/home/some/folders/images), and the corresponding URL has been entered as a subdomain (https://images.siteaddress.com)
The error_log indicates there is a redirect loop issue:
“Request exceeded the limit of 10 internal redirects due to probable configuration error.”
Has anyone come across this issue?
Thanks
JS
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hi,
Great plugin! It saved me a lot of MB’s!
There are two things that may be improved:
1) Images with special characters in their filenames are not resized because the url is not decoded first. I found that changing line 19 from
$filename = $matches[1].'.'.$matches[5];
into
$filename = urldecode($matches[1].'.'.$matches[5]);
fixed that problem.
2) The plugin uses the character ‘c’ at the end of a filename to indicate it needs to be cropped. This didn’t work for the images I had already uploaded before I installed the plugin. Maybe you can think of a solution for this. I fixed it by deleting all the resized images WordPress had created before. Then I changed the filenames in the metadata by running the following script:
$args = array(
'numberposts' => -1,
'offset' => 0,
'category' => NULL,
'orderby' => 'post_date',
'order' => 'DESC',
'include' => NULL,
'exclude' => NULL,
'meta_key' => NULL,
'meta_value' => NULL,
'post_type' => 'attachment',
'post_mime_type' => NULL,
'post_parent' => NULL,
'post_status' => NULL );
$attachments = get_posts( $args );
foreach ($attachments as $attachment) {
$meta = (get_post_meta( $attachment->ID ,'_wp_attachment_metadata'));
$meta_new = $meta;
$sizes = $meta[0]['sizes'];
if ($sizes) foreach ($sizes as $size=>$value) {
if (in_array($size,array('thumbnail', 'post-thumbnail', 'featured-image'))) { // put your images that need to be cropped here
$filename = $value['file'];
if (!preg_match('/(.*)(c).(jpg|png|gif)/i',$filename) ) {
if (preg_match('/(.*).(jpg|png|gif)/i',$filename,$matches) ) {
$newfilename = $matches[1].'c.'.$matches[2];
echo 'Found: '.$newfilename."\r";
$meta_new[0]['sizes'][$size]['file'] = $newfilename;
}
}
}
}
update_post_meta($attachment->ID,'_wp_attachment_metadata',$meta_new[0]);
}
Best regards,
Mila Witjes
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hi,
There is an issue with the plugin, the plugin block right the regeneration of the sizes, but when the 404 come and you regenerate the images, the images haven’t the same size/crop as expected.
I think it’s on the process for the generaton but i haven’t really look on.
Rahe
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hello Otto,
this is only as information, not a request.
I my test site I have commented the “if (is_multisite()) return;” in your plugin and, up to now it’s working fine.
BUT, I did a very small modification in wp-includes/functions.php because I was not getting the specified “upload path” when uploading in a secondary site. But the “upload path” was correct when uploading in the main site. This problem I had right from the beginning, without your plugins.
my mofification:
WP version: 3.2.1
file: /wp-includes/functions.php
function wp_upload_dir
original line:
$main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
modified line:
$main_override = is_multisite() && defined( 'MULTISITE' );
I do not pretend that this modification may not cause eventual problems, but for the time being it did solve my issue with the secondary site’s “upload path” not being passed properly. And I did not find the relevance of testing is_main_site();
And, so far, in this condition, your plugin is working fine in multisite.
Again, this is information, not a request.
Kind regards
Claude.
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>This is a simple & perfect solution for my way-too-many-image-sizes, thank you so so so much…
My (crazy & probably unfounded) concern: That extra “c” in the filenames – Is that ever going to be a problem? Does that make me committed to using the plugin forever once I’ve started? (I’m guessing no, as I just tested turning the plugin off and on… So I’m guessing WordPress, by default, stores the URLs of each image size instance in the db? So it won’t get confused when looking for something that should be there but there is a “c” involved…)
Also, potentially any problems with cache-ing? (Just tested it with wp-supercache and doesn’t seem to be a problem…)
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>Hi !
I have a little warning error ( line 72 ) when uploading a non image file.
The global var $dynimg_image_sizes
is empty and the code trying to make a foreach on it.
Otherwise the plugin is really great, would have to be a native feature!
Regards,
Rahe.
https://www.ads-software.com/extend/plugins/dynamic-image-resizer/
]]>