thumbnails broken on home page
-
I realize there are other threads open for this, but since some are old and some may have been resolved, I’m opening this anew. Also, this one implements a custom post type.
Here are some screenshots to get an idea of what’s going on: https://ge.tt/8ZummJ6?c
When I go to the post which has the broken thumbnail, the image is visible. I have run a process to regenerate all thumbnails of the originally uploaded image to ensure that all sizes are made available.
How can I modify the thumb URL so that I can test the phpthumb.php script with a valid image to see where the point of failure is?
Thanks! This plugin looks very very useful otherwise!
-
more info …
// Check for image file. $fileName = (isset($_GET['file'])) ? base64_decode($_GET['file']) : null; echo $fileName;
The above code in phpimage.php outputs ONLY the directory path to the image, but not the image filename. So now I suspect that the URL or path being fed to phpimage by the front-end widget code might be to blame. will follow-up.
Try to change the last post featured image. Switch to another by uploading it and resetting as default featured.
As i can see from one of yr screenshots, there is a problem with the image filetype. I don’t know why but the above might be a test.
Do the other images display correctly?
https://codex.www.ads-software.com/Function_Reference/get_attached_file
This function, which is what you use in class-main.php, displayPosts function, to get the path to the image, tries to grab the “_wp_attached_file” value from the postmeta table, and this value does not necessarily exist for all attachments. It does not exist for images which have been imported from another WordPress installation using the Export/Import method built into WordPress. It DOES exist for attachments which were uploaded using the media uploader within the current installation. Another way to get this path, which exists for all attachments as far as I can tell, is to get the path from deserializing the attachment metadata. in code, this is:$md = maybe_unserialize( wp_get_attachment_metadata( get_post_thumbnail_id($post->ID) ) );
Next, get the image path relative to the uploads folder:
$thumbabs = $md['file'];
This does get the path and feeds it to phpimage.php, but phpimage still complains that the file doesn’t exist. I tried replacing the last line with this, which gives phpimage the full path to the image:
$thumbabs = WP_CONTENT_DIR . '/uploads/' . $md['file'];
But this just causes phpimage.php to show a blank page – no errors, nothing. So now I feel like phpimage.php might have issues.
[EDIT 12:13EST]
IGNORE THE POST BELOW.IT DID WORK AFTER I RESET THE FEATURED IMAGE.
It was not working originally because I had put some debugging output into phpimage.php, and it was rendering the image output invalid, so it was just showing up blank.
Still, I think the method I proposed for getting the path to th image might work more universally. In other words, I replaced:
$thumbabs = base64_encode(get_attached_file(get_post_thumbnail_id($post->ID)));
with
$md = maybe_unserialize( wp_get_attachment_metadata ( get_post_thumbnail_id( $post->ID ) ) ); $thumbabs = base64_encode( WP_CONTENT_DIR . '/uploads/' . $md['file'] );
Maybe you can come up with a better way to do this.
Thanks again!
—————
responding to your last post, I tried uploading a new JPG to the post and set it as the new featured image, and the thumb was still broken, but when I opened the image in a new tab to look at the errors, I got the blank screen.
The URL returned was
https://155.43.82.113/t3/wp-content/plugins/special-recent-posts/lib/phpimage.php?width=100&height=100&rotation=no&file=L2hvbWUvamFtZXMvd29ya3NwYWNlL3QzL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDExLzA3LzI1ODYyNF8xMDE1MDE5NDUwMTc2ODExMF81MDE3MjMxMDlfNzExODQwMl81MDkyOTY1X28uanBn
When I decode that file string, it is
/home/james/workspace/t3/wp-content/uploads/2011/07/258624_10150194501768110_501723109_7118402_5092965_o.jpg
– this path is correct. I think my proposed method to get the path is better … perhaps more universal, but at least this gets us a little closer.So now the question is: what’s happening in phpimage?
Well, that’s a really nice suggestion. But i have to clear a couple of things.
The SRP plugin first tries to fetch the featured image for each post. If, for some reason, this image isn’t available( so maybe you’ve imported an XML file as you did), then the plugin tries to fetch the first image in the post content. So, in any case, the plugin tries to grab an image.The issue you’ve reported has appeared a couple of times and basically it has been resolved by reuploading images.
BTW, i’m actually working on version 2.0 which will include many more features and improvements as image caching, and, at this point, a better image retrievement method. So thanks a lot for your interest. I’ll let you know as soon as the new version is available.
OK, great!
Well at least you know now that the current version does not always grab the first image from the post content, even if it exists and is valid.
The code I suggested is what I’ll be using until v2. Thanks very much for this free plugin!
Any news?
My plugin can’t retrive default post image, so no thumbnail is displayed on sidebar…Would very much like an update on this if one exists. Like jrevillini, I am creating a new WP site based on an import from a previous site, and therefore the SRP plugin isn’t identifying the images that are in each post. It only works if I go back and manually set each image as “featured”, which I don’t want to do for 1200 posts.
I’m using next gen for default images and getting this error, despite re-uploading the image I get the same result: File is not a valid image: /home/vmdomain/public_html/wp-content/uploads/
Fatal error: Call to a member function adaptiveResize() on a non-object in /home/vmdomain/public_html/wp-content/plugins/special-recent-posts/lib/phpimage.php on line 42 It would be helpful to know if I’m on the right thread here or whether this might be another issue altogether. When I use wp library it works fine. When I use a Nextgen image it breaks. Any leads appreciated. Thanks@mpet29 idk if this will work but the Auto Featured Image may set the featured image automatically. It shouldn’t hurt to try but backup first of course https://www.ads-software.com/extend/plugins/auto-featured-image/
@okso (cool name btw) sounds different. i’m not really sure how nextgen works … does it replace the standard upload process?
hi j, yes it does, dir set here: Gallery path = wp-content/blogs.dir/%BLOG_ID%/files/ using GD Library > /wp-content/blogs.dir/1/files/base_website/thumbs/thumbs_sc_ayurvedafishing.png I read point 3 on the plug page refers to needing image to be on the same domain, is it likely that its also sensitive to a non wp library file path? d
@okso I think using nextgen is going to be a problem. From what I understand from reading the installation and usage info on the nextgen page, you’re creating these galleries independent of posts/pages and then including them with a shortcode. Since there is no true link between the post/page and the gallery, the SRP plugin has no idea about the images which will be shown on that post/page. I’m not sure if you have any programming background, but the easiest way I can explain it is that shortcodes (e.g. ‘[nggallery id=x]’) are not processed until someone tries to see your page/post. On the other hand, when you upload images to a page/post or even just include an image in a page/post, the SRP plugin can ask the post “what pictures are in you?” and then it makes some decisions on what to display as the little thumbnail. When using the nextgen shortcodes, when SPR asks “what pictures are in you?” the post is responding “I got nothing for you except some shortcode I don’t understand yet” so SRP displays nothing. It’s not a bug in SRP. It’s an incompatibility that would be pretty difficult to overcome without adding a ton of extra processing for every post that is to be displayed through SRP.
Disclaimer: I could be wrong about all of this. I made a few assumptions here.
Hi j, I was working on the assumption that by creating a default image within a wordpress post you are in effect creating a true relationship, not a shortcode, between the post default image and an image file path such as plugins/yd-recent-posts-widget/timthumb/timthumb.php?src= ***NextGen path*** /wp-content/gallery/events/thumbs/thumbs_berrybiketour.png&h=60&w=60&zc=1&q=100 Does this help or am I confusing the matter further? d
@okso do you mean featured image? i’m not sure what you mean by default image. Also, where do you see that path you referenced? If you view the HTML for the post, do you see
<img src="{your path}" ...>
anywhere?yes, sorry, feature image.
<img src=”/wp-content/plugins/yd-recent-posts-widget/timthumb/timthumb.php?src=/wp-content/gallery/events/thumbs/thumbs_berrybiketour.png&h=60&w=60&zc=1&q=100″
- The topic ‘thumbnails broken on home page’ is closed to new replies.