VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: marvays on May 22, 2021, 09:17:48 AM

Title: turn off noimage.gif and warning.png
Post by: marvays on May 22, 2021, 09:17:48 AM
Hello.
Is it possible to turn off the generation of noimage.gif and warning.png images?

When there is a problem with images on the site (for whatever reason), virtuemart immediately displays noimage.gif or warning.png images. Website audit tools then can't detect the problem because they don't see any missing images.

I speak from personal experience. 3 days ago, 300 product images mysteriously disappeared from my ftp. The site auditor did not detect this once. When the site visitor noticed. And that's not good.

For example, is this option not in the hidden settings of the VM?
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 22, 2021, 09:34:23 AM
QuoteI speak from personal experience. 3 days ago, 300 product images mysteriously disappeared from my ftp.
If the images are gone, how will VM know this ? When it can't se the original image it uses the noimage.gif instead. It does not generate any noimage.gif files.

Removing noimage.gif should do it or make an override to set your own error message. Look also in VM back end under configuration for possible options.

Jörgen @ Kreativ Fotografi
Title: Re: turn off noimage.gif and warning.png
Post by: pinochico on May 22, 2021, 09:51:34 AM
A common mistake made by admin clickers, but unfortunately also by most developers:

They cannot and do not solve the cause of the problem, but they develop patches and fixes (sometimes their own mistakes).

Here you need to find out the reason and ensure that the images are "mysteriously" not lost on the ftp.

Turning off the noimage system is very wrong, especially for many e-shops that import data from their suppliers without images.

And asking for an administrator error by interfering with the core code of the VM is no longer wrong, but more than bold (if my developer does something like that, I prefer to use the word punishable).
Title: Re: turn off noimage.gif and warning.png
Post by: marvays on May 22, 2021, 10:05:59 AM
Good. I'll explain it differently. So you can understand me.

I don't want to hide the mistake, but find it! For these purposes, I use a tool that looks for errors (broken links, missing images). But if the VM hides the bug by displaying another image instead, no tool in the world will detect it.

But if the VM doesn't do this hiding image errors, the tools will find the error and I can fix it. Do you understand?
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 22, 2021, 10:44:47 AM
See my previous answer...

Jörgen

Title: Re: turn off noimage.gif and warning.png
Post by: marvays on May 22, 2021, 11:07:58 AM
Quote from: Jörgen on May 22, 2021, 10:44:47 AM
See my previous answer...
Jörgen
I see it. But that won't solve the problem. The only change will be that the warning.png image will be missing
Plus, it's not a nice hard-to-delete solution. I would like VirtueMart not to do this replacement at all. In order to only and only display the image of the product and if there is a problem with the image, my seo tool will find it. simple solution.
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 22, 2021, 11:25:50 AM
As i är ut if you delete the ONLY copy of noimage.gif VM will find it. If the varning.gif image is displayer instead, remove this also.
Have you even tried this option?
The next option is to do spend 5 min with an override in your template.

Jörgen
Title: Re: turn off noimage.gif and warning.png
Post by: marvays on May 22, 2021, 11:29:25 AM
Quote from: Jörgen on May 22, 2021, 11:25:50 AM
As i är ut if you delete the ONLY copy of noimage.gif VM will find it. If the varning.gif image is displayer instead, remove this also.
Have you even tried this option?
The next option is to do spend 5 min with an override in your template.

Jörgen
Yes he tried. This is because I have the error "missing image warning.png" on the page, because even if I delete the image, the VM still wants to display it.

But your last sentence is exactly what I needed to hear. I thought it was a systemic thing. Not a piece of code in the template. I'm going to look at it. Thank you Jörgen

Title: Re: turn off noimage.gif and warning.png
Post by: GJC Web Design on May 22, 2021, 12:32:29 PM
look at function displayMediaThumb() in  \administrator\components\com_virtuemart\helpers\mediahandler.php

perhaps just commenting out  //$this->setNoImageSet();

will be enough to proceed with the missing image path
Title: Re: turn off noimage.gif and warning.png
Post by: marvays on May 23, 2021, 06:03:15 AM
Quote from: GJC Web Design on May 22, 2021, 12:32:29 PM
look at function displayMediaThumb() in  \administrator\components\com_virtuemart\helpers\mediahandler.php

perhaps just commenting out  //$this->setNoImageSet();

will be enough to proceed with the missing image path
this doesn't work :(
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 23, 2021, 10:06:06 AM
Then You have to tell us what You want to happen. And how it should work.

This is NOT a bug i VM.

Can You not tell your tool to look for links to noimage.gif ?

Jörgen @ Kreativ Fotografi
Title: Re: turn off noimage.gif and warning.png
Post by: marvays on May 23, 2021, 10:48:31 AM
I'm not saying it's a VM bug. I don't even think so. I just want VM to do nothing. No replacement.

When a product has a problem, each seo tool finds it with a missing image or a broken link.
See: https://help.ahrefs.com/en/articles/2628254-image-broken-error-in-site-audit
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 23, 2021, 13:46:26 PM
Hello

I am not going to rewrite your code, but here is something to get You started:

In your template file "default:images.php" you will find something like this:
if (!empty($this->product->images)) {
$image = $this->product->images[0];
?>
<div class="main-image">
<?php
$width VmConfig::get('img_width_full'0);
$height VmConfig::get('img_height_full'0);
if(!empty($width) or !empty($height)){
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'"truetruefalse$width$height);
} else {
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");
}
 ?>

<div class="clear"></div>
</div>
<?php
}


Test for noimage.gif or empty file name like this:

if (!empty($this->product->images)) {
$image = $this->product->images[0];     
?>
<div class="main-image">
<?php
$width VmConfig::get('img_width_full'0);
$height VmConfig::get('img_height_full'0);

                
// JH 2021-05-23  display a broken link if noimage.gif or no image found

                
if (('' == $image->file_name) or ('noimage'  == $image->file_name)){
                  echo 
'<img src="imageLost.gif" >';  
                } else {   
  if(!empty($width) or !empty($height)){
echo $image->displayMediaThumb("",true,"rel='vm-additional-images'"truetruefalse$width$height);
  } else {
 
echo $image->displayMediaFull("",true,"rel='vm-additional-images'");
  }
               }
       ?>

<div class="clear"></div>
</div>
<?php 
}
?>



Code has been tested but rewritten, Not retested.

This will probably have to be impleneted in more places, but you have a starting point. This is a template change.

If You choose to delete the noimage.gif You will probably get a new file on every VM update. The fix should work either way.


Jörgen @ Kreativ Fotografi
Title: Re: turn off noimage.gif and warning.png
Post by: GJC Web Design on May 23, 2021, 15:32:42 PM
@Jörgen

what he wants is for VM to display the broken or non existing file as a 404 so his site checker can detect it and he can fix it

in the function displayMediaThumb() if the image path or file is wrong/missing it will always return the set noimage.gif ...  this happens before the result is sent to the template..

So on the frontend it isn't obvious what the missing file is ... 

but @marvays .. it is obvious what is missing in the admin .. so turn on VM debug and go thru your product admin looking for missing images etc or add some logging in the \administrator\components\com_virtuemart\helpers\mediahandler.php to catch them when rendered at the frontend
Title: Re: turn off noimage.gif and warning.png
Post by: Jörgen on May 23, 2021, 22:12:46 PM
@gjc

My solution will give hon a broken link, this is what he is asking asking for.

QuoteI don't want to hide the mistake, but find it! For these purposes, I use a tool that looks for errors (broken links, missing images). But if the VM hides the bug by displaying another image instead, no tool in the world will detect it.
/quote]
Anyway, this is what comes to mind.
Jörgen
Title: Re: turn off noimage.gif and warning.png
Post by: Clonners on July 27, 2021, 20:37:53 PM
Is it possible to somehow recover the missing images?
Title: Re: turn off noimage.gif and warning.png
Post by: pinochico on July 28, 2021, 08:27:32 AM
what do you mean "recover" ?

If I need recover deleted files on my macbook pro, then I use special application.
If I need recover deleted files on ftp, then I use akeeba backup or (because we use own server) take backup from every day backup on server.