Does Imsanity resize the images already on a Site?
-
Hi
Does Imsanity resize the images already on a Site or only new images uploaded after the plugin has been installed?
thanks
-
@verysimple again
I did a bit of experimenting and found that if I edit the limit you placed on the number of images found in the bulk search from 250 to 300 (in ajax.php), I find the next 50 large images that I have. I tried re-sizing just one of them using the bulk feature and it worked.
I am afraid to go further with this on my own, since it has the potential of screwing something up; I don’t have enough experience to know if I’m on the right track or not. I see your comment in the code “// make sure we only return up to 100 records so we don’t overload the ajax features”. I would guess I would need to raise the limit above 300 (or some other way to find the additional images), and I have no idea if this is good idea or not….
Thanks again for the fantastic plug-in!
You’re right, images past #250 weren’t being returned. the counter was in the wrong place. I just fixed that and submitted version 2.1.3 which should be available soon. It still limits to 250 in a single pass, but after you re-size those 250, you can search again and get another 250.
the search function does query the database, not the file system. so any images that were uploaded outside of the wordpress uploader wouldn’t be returned. but anything uploaded through wordpress should be there.
The 250 limit is somewhat arbitrary to keep the page stable. You could change that number to something higher if it helps and most likely it would be ok. i’d say you could probably raise the limit into the thousands. The worst that would happen is your browser would get really sluggish and possibly the page would stop responding. But it wouldn’t hurt the images.
Thanks for alerting me!
Thanks again for the great plug-in! The fix was just what I needed, and I’ve just finished re-sizing several batches of really huge images down to reasonable sizes. You saved me an amazing amount of time!
great! Feel free to give Imsanity a good rating and click the “It Works” button in the plugin directory!
Just wanted to let you know that I had a chance to try the bulk resizer on another site today and it worked like a charm!
Thanks again! You rock!
Hi Verysimple,
First of all, I would like to say a HUGE thanks for developing this plugin. My problem is that not all the images seems to be listed in the batch resizer. It’s not the 250 limit, I edited it to 2500 and it’s still the same. After one batch resizing the plugin believe that it has resized all the images, while it hasn’t. There are images which were missing from the list and not listed even after the resize.
Hmm, well the simple thing to verify first is that the images are actually larger than your configured limit? Imsanity won’t offer to resize images that do not exceed the max size.
If that’s not the case, the next thing to know is that all images that are uploaded via regular WordPress upload functions will have a matching record in the wp_posts table. Imsanity looks in the database for files – it doesn’t look at the filesystem. This record in the database also contains metadata about the image, including the size. Imsanity does not go recursing through your folders examining images, it just looks at this table to determine everything.
If an image is uploaded by a plugin or simply just uploaded directly to the server via FTP and it doesn’t have a matching record in the wp_posts table then Imsanity will not be aware of it’s existence. Or if the metadata for the image does not show the correct image size, then that could be another reason (though I think that would be unlikely).
I would start the detective work by locating one single image that you suspect should be resized but is not being handled by Imsanity. Then check the size first, then check the database to see if it’s in there, then finally look at the metadata and see what that looks like as well.
Hi Verysimple,
All the images were uploaded by the normal “attach photo”, but about 50% of them were missed by the script.
Anyway, I found an amazing solution, but it requires shell access:
#!/bin/bash
for img infind . -name *.jpg -printf '%p\n'
do
echo $img;
mogrify -quality 90 -strip -resize “960×800>” $img;
donewere you able to see if they have matching database records in the wp_posts table? If they do and Imsanity is missing them for some reason I’d like to fix it.
Also, if there are records in there and you resized them using the shell script, then WordPress will have the wrong meta data about the images. (possibly not a major issue, though may confuse WordPress when you embed full-sized images into a post)
Hi verysimple,
I think the problem is not on your side, it’s something with WordPress. On the filesystem, I have files just differencing in a number at the end.
IMG_3391sat.jpg
IMG_3391sat1.jpg
IMG_3391sat2.jpg
IMG_3391sat3.jpgThey all have the same size and are the same images. In WordPress what happens is that their post_title is the same, but their post_name differs. Also their guid differs.
To show in SQL, this is what happens:
select post_title, post_name, guid from wp_posts where post_title like "%IMG_3391sat%"
>
IMG_3391sat img_3391sat …/2011/09/IMG_3391sat.jpg
IMG_3391sat img_3391sat-2 …/2011/09/IMG_3391sat1.jpg
IMG_3391sat img_3391sat-3 …/2011/09/IMG_3391sat2.jpg
IMG_3391sat img_3391sat-4 …/2011/09/IMG_3391sat3.jpgIf you group by post_title, there will be only one returned. If you group by post_name all 4 will be returned. So I think to fix your code you just need to query using post_name and not post_title.
hmm, i’m not sure what the deal is. imsanity neither looks at the post_title nor post_name columns. The query actually looks like this so perhaps you could see why this might be missing the rows from your system..?
select * from posts inner join postmeta on posts.ID = postmeta.post_id and postmeta.meta_key = '_wp_attachment_metadata' where post_type = 'attachment' and post_mime_type like 'image%' and post_mime_type != 'image/bmp'
- The topic ‘Does Imsanity resize the images already on a Site?’ is closed to new replies.