<commit_before><?php

namespace WBB\CoreBundle\Twig\Extension;

use Symfony\Component\DependencyInjection\ContainerInterface;

class ShowMediaFilterExtension extends \Twig_Extension
{
    private $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('showMedia', array($this, 'showMediaFilter')),
        );
    }

    public function showMediaFilter($path)
    {
        // Define the path to look for
        $pathToCheck = realpath($this->container->get('kernel')->getRootDir() . '/../web/') . '/' . $path;

        // If the path does not exist, return the fallback image
        if (!file_exists($pathToCheck) || $path != "/")<commit_msg>Image fix<commit_after><?php

namespace WBB\CoreBundle\Twig\Extension;

use Symfony\Component\DependencyInjection\ContainerInterface;

class ShowMediaFilterExtension extends \Twig_Extension
{
    private $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('showMedia', array($this, 'showMediaFilter')),
        );
    }

    public function showMediaFilter($path)
    {
        // Define the path to look for
        $pathToCheck = realpath($this->container->get('kernel')->getRootDir() . '/../web/') . $path;

//        var_dump($pathToCheck);die;

        // If the path does not exist, return the fallback image
//        if (!file_exists($pathToCheck) || $path != "/")
//        {
//            return $this->container->get('templating.helper.assets')->getUrl('bundles/wbbcore/images/default.jpg');
//        }
        if (!@getimagesize($pathToCheck) || $path == "/")
{'fraction_non_alphanumeric': 0.13785675821217017, 'fraction_numerical': 0.0, 'mean_word_length': 2.8230452674897117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '531246', 'n_tokens_mistral': 526, 'n_tokens_neox': 521, 'n_words': 111}