*

Own Petz

  • ****
  • 170 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
After Updating Blog Plugin Article images Not Showing
« on: September 06, 2024, 09:29:23 AM »
Hello,

Last time when I updated my Blog Plugin there is new update for changing image folder location - Plugin images are now stored in oc-content/uploads/blog folder, instead of oc-content/plugins/blog/img/

But Yesterday I have checked my old articles which have images inside articles not showing or showing like image not found (check attached image) Because of upload image path changed...

old path - https://ownpetz.com/oc-content/plugins/blog/img/tinymce/20230715130556_elai.jpg
New path - https://ownpetz.com/oc-content/uploads/blog/tinymce/20240813142130_Bing%20Setting.jpg

That's why this error occured. While article main image (which is on top) display, but images inside article not showing..

I have tried to copy tinymce folder into img folder then its working but this folder automatically deleting after 5-10 minutes. Can you please tell me how to fix this issue. Because I can not edit all old articles (more than 3000) then rechange path... Only tell me how to keep tinymce folder in img folder also... So that old articles will work properly.


Thanks in Advance.
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 170 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: After Updating Blog Plugin Article images Not Showing
« Reply #1 on: September 06, 2024, 09:30:27 AM »
I found this for migration in functions.php in blog, how can i edit this so that that folder not deleted


// MIGRATE FILES TO UPLOADS FOLDER
// This is one time action. When done, old folder in plugin is removed and code is not triggered!
function blg_migrate_images() {
blg_create_upload_folders();
$subfolders = array('blog','tinymce','user');

foreach($subfolders as $sub) {
$file_path_old = osc_content_path() . 'plugins/blog/img/' . $sub . '/';

if(file_exists($file_path_old)) {
$files = glob($file_path_old . '*');

if(count($files) > 0) {
foreach($files as $file_old) {
@rename($file_old, blg_file_path(basename($file_old), $sub));
}
}

@rmdir($file_path_old);
}
}
}

osc_add_hook('init_admin', 'blg_migrate_images');
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 170 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: After Updating Blog Plugin Article images Not Showing
« Reply #2 on: September 06, 2024, 09:44:39 AM »
Or is there any option to change the path that article inside images using.

Previous inside article path is  https://ownpetz.com/oc-content/plugins/blog/img/tinymce/20230715130556_elai.jpg


because images in tinymce is Ok


but path is wrong they didn't check after new update.

Old Path

https://ownpetz.com/oc-content/plugins/blog/img/tinymce/20230715130556_elai.jpg



New path

https://ownpetz.com/oc-content/uploads/blog/tinymce/20240813142130_Bing%20Setting.jpg
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 170 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: After Updating Blog Plugin Article images Not Showing
« Reply #3 on: September 06, 2024, 08:47:32 PM »
Waiting for reply...

And one more thing


If I am writing new article and insert images inside articles or if I edit old articles and insert images inside articles then images showing.. it's not a problem.. as I already said.


Problem is old articles which have images already inside articles that are not showing while that images are in tinymce folder..
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 170 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Re: After Updating Blog Plugin Article images Not Showing
« Reply #4 on: September 07, 2024, 10:37:06 AM »
I have fixed this issue by removing this code - and paste that tinymce folder in img folder.

osc_add_hook('init_admin', 'blg_migrate_images');


but this is not a perfect solution. I need a Perfect solution.
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com