Easyblog Missing Images Work Around

News Show Pro GK5 - flexible, responsive and easily extendable free Joomla module support forum.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Tue Sep 29, 2015 2:59 am
After some effort I think I have found a partial solution to using News Pro with Easyblog5.
I have had many issues with NewsPro not picking up the image from the blog. This is ONLY AN ISSUE when the image is the Cover Image or the Blog image. If the image is embedded as the first image in the blog text, all is good.
I first had problems when I upgraded even posted a problem, but I thought the issue was solved however it was just masked because all works well if the image is the first one inside the blog text.
So the key is in the file /tmpl/com_easyblog/view.php around line 21 where the code checks to see if there is a path in the image field of the easyblog_posts table. If there is a path it means there is a cover image.
For me there are two problems.
Case 1
The blogs were imported from a previous version of Eastblog and I did their upgrade. Even with the latest version of NewsPro I did not get cover/blog images. If I looked in the path of the image file stored in the easyblog posts table it was of the form user:ID/imagename.jpg, in my case user:991/imagename.jpg would be typical.
I see the code in the current NewsPro looks for the string post: and removes it with a string replace on about line 26. I changed it to replace user: and that helped clean up my path.
Case 2
Same issue above but my images were stored in the folder images/easyblog_image/ not the images/easyblog_articles/ which is the current easyblog default. So I also had to change the path that is added on line 28 to be the same as mine and what I had set in the easyblog media settings.
Case 3
This was a big deal to find. If the easyblog installation is default, the media settings have the shared folder set to images/easyblog_shared/ if you use this option and allow users to store media in it and they post that media as the cover image, again NewsPro does not pick up the images. The problem is that the path easyblog chooses to put in their table has the form shared/imagename.jpg and somehow NewsPro is supposed to change to replacing shared/ with easyblog_shared/. At first I was about to hack the view.php file to test for the new case and replace shared/ with easyblog_shared. But I found a simpler fix.
I moved all my images from images/easyblog_shared/ to images/easyblog_articles/shared and changed the shared directory path in the easyblog media settings to match. Now my images show up and the NewPro code only needed the post/user hack. Now if you have a lot of shared media files embeded in the blog text this fix will break them, but for me I was in the upgrade test phase so not an issue.

Future?
Well somehow I think there is more to this, easyblog probobly has more cases for file paths that get put in their blog table, I do not think NewPro coders made up the post: case. But for now this fix is stable. I do think easyblog coders could just put the real image path in their table. Would help us all. I also worry that it seems easyblog puts the full site path into the blog text when you put a shared image into the blog text. This will cause me all sorts of problems whenever I move a site.
User avatar
Junior Boarder

teitbite
Wed Sep 30, 2015 10:39 am
Hi

I agree, all the problems are because of changing the default image storage folder, unfortunatelly we have no other option just to adjust our module to it.

In EasyBlog options there should be a selection of which image to use. Is it not working for You ?
User avatar
Moderator

GK User
Wed Oct 07, 2015 3:37 pm
Yes the image select does work, but making it what your module is accepting is only part of the solution, the need to change post: to user: in the file path is a ball breaker. Also if you want to use any of the media from their media manager store you need to make the trick change to the location of the media store.
I do not blame your coders, they have an almost impossible task and the easyblog data store really should have a valid file path and not a mix of file path and type of image.
User avatar
Junior Boarder

GK User
Wed Oct 07, 2015 4:15 pm
Oh dear, it gets worse. I was looking up my old post because I was setting up a new site and guess what, Easyblog does not work with my modified version of news Pro, this time I do not get any article text.
Investigations show that when you use their new built in editor it put text into two places in their data file. They are document text and content. They use and expect to use content, the document text looks like some version control or backup.
But if you use the external editor that is normally the one used by Joomla the text gets put in a different two places.
These are document text, and Introduction.
The News Pro seem to only use the text in Introduction, so if you use the EasyBlog editor to make posts you are not going to get any text.
A hack is in /data_sources/com_easyblog/model.php about line 305 change "content.intro AS text" to become "content.content AS text"
But now you need to choose which editor you use and stick to it.
Hope this helps someone.
User avatar
Junior Boarder

GK User
Wed Oct 07, 2015 4:33 pm
Will this ever end?
Trashed Easyblog posts will still get displayed by Newspro because they are still marked as published. Seems Easyblog use a table entry "state" that has a value of 0 when "normal" but "state = 1" when an article is trashed.
So a hack to stop NewsPro displaying trashed posts is again in the /data_sources/com_easyblog/model.php file about line 264.
under the line "content.published = 1"
add a new line
"AND content.state = 0"
This will check if the article is not in the trash. Seems to work for me today.
User avatar
Junior Boarder

teitbite
Fri Oct 09, 2015 11:08 am
Hi

That's a really useful inside. I will inform programmers about this so they will be able to fix it in packages. Thank You.
User avatar
Moderator


cron