Jump to content

No more images on front-end


Oca2
 Share

Recommended Posts

Dear Processwirez,

After updating to 2.8.62 some code doesn't seem to work anymore.

There are no more images on the front-end. Image url's on front-end are empty.

if($page->mosaik_title_1) { echo "
<div class='three columns'>
<a href='{$page->mosaik_url_1}/'>
<span class='m1'>{$page->mosaik_title_1}</span>
<img src='{$page->mosaic_photo_1->eq(0)->getThumb('thumbnail')}' alt='{$page->mosaic_photo_1->description}' /></a></div>";}

and

foreach($page->children as $child)
            echo "
                <div class='cat1 cat5'>
                <div class='port-item-container'>
                    <div class='port-box'>
                            <a rel='bookmark' title='{$child->title}' href='{$child->url}'>
                            <img src='{$child->overviewimg->eq(0)->getThumb('thumbnail')}' alt='$child->title'>
                            </a>
                    </div>
                    <div class='port-item-title'>
                        <h6>{$child->title}</h6>
                        <span>{$child->overviewtxt}...<a href='{$child->url}'> Lees verder »</a></span>
                    </div>
                </div>
                </div>
                ";

Both codes are from different pages and both doesn't work anymore after the upgrade.

Link to comment
Share on other sites

Ok... updated to 3.0.62 installed CroppableImage3 now I get the following errors...

User Error
Exception: Method Pageimage::getThumb does not exist or is not callable in this context (in /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php line 519)

#0 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(386): ProcessWire\Wire->___callUnknown('getThumb', Array)
#1 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___callUnknown', Array)
#2 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pageimage), 'callUnknown', Array)
#3 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(445): ProcessWire\Wire->__call('callUnknown', Array)
#4 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(445): ProcessWire\Pageimage->callUnknown('getThumb', Array)
#5 /domains/somesite.nl/DEFAULT/fresh/site/assets/cache/FileCompiler/site/templates/home.php(16): ProcessWire\Wire->__call('getThumb', Array)
#6 /domains/somesite.nl/DEFAULT/fresh/site/assets/cache/FileCompiler/site/templates/home.php(16): ProcessWire\Pageimage->getThumb('thumbnail')
#7 /domains/somesite.nl/DEFAULT/fresh/wire/core/TemplateFile.php(268): require('/domains/gemsbo...')
#8 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render()
#9 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___render', Array)
#10 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#11 /domains/somesite.nl/DEFAULT/fresh/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array)
#12 /domains/somesite.nl/DEFAULT/fresh/wire/modules/PageRender.module(514): ProcessWire\TemplateFile->render()
#13 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
#14 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___renderPage', Array)
#15 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array)
#16 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(782): ProcessWire\Wire->__call('renderPage', Array)
#17 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(782): ProcessWire\PageRender->renderPage(Object(ProcessWire\HookEvent))
#18 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array)
#19 /domains/somesite.nl/DEFAULT/fresh/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Wire->__call('render', Array)
#20 /domains/somesite.nl/DEFAULT/fresh/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Page->render()
#21 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(383): ProcessWire\ProcessPageView->___execute(true)
#22 /domains/somesite.nl/DEFAULT/fresh/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___execute', Array)
#23 /domains/somesite.nl/DEFAULT/fresh/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array)
#24 /domains/somesite.nl/DEFAULT/fresh/index.php(55): ProcessWire\Wire->__call('execute', Array)
#25 /domains/somesite.nl/DEFAULT/fresh/index.php(55): ProcessWire\ProcessPageView->execute(true)
#26 {main}

 

Link to comment
Share on other sites

changing...

<img src='{$child->overviewimg->eq(0)->getThumb('thumbnail')}' alt='$child->title'>

to...

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')}' alt='$child->title'>

did not work...

...and give error:

Exception: There is no crop setting for the template 'home' called 'thumbnail' (in /domains/gemsbok.nl/DEFAULT/fresh/site/modules/CroppableImage3/FieldtypeCroppableImage3/FieldtypeCroppableImage3.module line 209)

And have set the crop setting to square,160,160

Link to comment
Share on other sites

2 minutes ago, adrian said:

You need to have a read of this: https://processwire.com/talk/topic/14251-upgrading-from-thumbnails-module-to-croppable-image-3/

Also note that once you have taken care of that, you need to add ->url to the end of your src - croppable image returns a pageimage object, not a url like the old module did.

no simple update... will look in to your link... Thanks for the info!

Link to comment
Share on other sites

No more errors :)

But...

I don't want to go through the update process renaming all images files... to complicated so I will manually update the images...

...But if I select new images from admin they are still not visible on the front-end???

Link to comment
Share on other sites

24 minutes ago, Oca2 said:

...But if I select new images from admin they are still not visible on the front-end???

Have you looked at the path to the image in the HTML? Did you add the ->url at the end? If it's a multiple images field, you will also need ->first() in there or a foreach loop to get each image individually.

Link to comment
Share on other sites

Tis is the code I use now, no errors but also no images on front-end

 

<img src='{$page->mosaic_photo_1->eq(0)->getCrop('thumbnail')}' alt='{$page->mosaic_photo_1->description}' /></a></div>";}

and

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')}' alt='$child->title'>

Link to comment
Share on other sites

10 hours ago, Oca2 said:

Tis is the code I use now, no errors but also no images on front-end

Sorry to sound like a broken record, but CroppableImage returns a pageimage object, not a url, so you need to add ->url to the end of that:

<img src='{$child->overviewimg->eq(0)->getCrop('thumbnail')->url}' alt='$child->title'>

If you take a look at the HTML source of the page you would have seen that it was return an ID and not a URL to the image.

Also another tip is to use the Console Panel in Tracy to investigate things. In particular note what happens when you echo (which outputs a string) that it returns the filename, but not the URL.

 

image.png.54d9838a1ab5475b9a5f5f90f19d399b.png

 

 

 

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...