-
Couldn't load subscription status.
- Fork 563
Enhanced Post.FirstImgSrc method to really find the first image #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...e content using regular expressions. The previous code didn't find images with styls or other attributes and that was a problem. Bumped minor version to reflect change.
I think this project has low activity now, but this helped me! Thanks
Thanks. Happy to help.
It's a pity that a lot of projects in the .NET world, used by thousands of people, get abandoned 😞
There is a conflict since this is way old.
But, because many themes don't have that default image (images/defaultImg.jpg), it's not a good idea to get it from the themes.
The best solution to this is to let the admin upload it from the settings. which will be the default post cover. But again, what if the theme doesn't support the cover.
But for now, I think the best default image would be a "data:image/svg+xml" like below that shows the Blog Title in the center of the image:
data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 700 300' width='700' height='300'%3E%3Crect width='700' height='300' fill='%23000000'%3E%3C/rect%3E%3Ctext x='50%' y='53%' dominant-baseline='middle' text-anchor='middle' font-family='Arial, sans-serif' font-size='30px' fill='%23ffffff'%3EBlog Title%3C/text%3E%3C/svg%3E
Anyways,
We are working on a new project similar to BlogEngine, please check it out:
https://github.com/blogifierdotnet/Blogifier
I'm closing this, If you wish to make the changes, please open this with the updates.
Hi:
I was just rewriting an already existing method to make it a little better. The problem with the conflict is that my PR is more than 3 years old, and the first response by a maintainer is just now 😒
If there's no image there's no problem at all (the same way that wasn't a problem before). It's just a better regular expression, that's it.
I agree on BlogEngine not being the best option to create a blog today with .NET, but if you have been using it for decades and have thousands of posts and comments (like myself), maybe you don't have a good chance to do a proper migration. My other blog, smaller, it's already migrated to a different system log ago. My main blog, unfortunately, it's not as easy to migrate without loosing a lot of info or without glitch.
Cheers!
Jose,
I'm sorry, but maintaining an open-source project, without contributions, is not an easy task.
Blogifier is under development. But already, you can import RSS. and all of your posts, files, categories will be imported.
We have plans to make it easier to migrate from BlogEngine to Blogifier. hopefully soon.
Hi @farzindev
Don't worry, I totally feel you, as I'm maintaining some projects by myself too (less popular, of course). But sometimes written communication can be misleading and one can sound harsh. Sorry about that.
Thanks!
Hi:
I've just changed the
Post.FirstImgSrcmethod's code to really find the first image in the post content using regular expressions.The current code didn't find images with styles or other attributes, and that was a problem since a lot of people include images with different styles or alignments such as:
The current method only finds images that start exactly with:
My change is 100% compatible with the previous but uses regular expressions to really find the first image in the post contents.
Bumped minor version to reflect change.
Thanks!