Jump to content

Problem w. image sizing and displaying while including / bootstrapping Processwire


DV-JF
 Share

Recommended Posts

Hi,

I figured out a strange problem and don't know where to search for the error:

I'm trying to include Processwire into an old website project in order to use PW for a little news-system . Therefore I'm using this code.

<?php namespace ProcessWire;

/*Include ProcessWire f. News */
include $_SERVER['DOCUMENT_ROOT'].("/cms/index.php"); 

/* Set news variable to get news from PW */
$news = wire('pages')->find('template=news-page');?>

Now I'm able to loop through the news and display them as I want to be.

<?php /* Section - Aktuelles */

if(count($news)) { ?>

<div id="aktuelles" class="section-wrapper section-std-padding container activateMenu">

  <h2 class="sectionhead">Aktuelles</h2>

  <?php foreach ($news as $n) { ?>

  <div class="box big-image">
    <div class="two-text-columns">
      <div>
        <a href="<?php echo ("/cms" .$n->sing_img->url .$n->sing_img);?>" class="img-popup"><img src="<?php echo ("/cms" .$n->sing_img->url .$n->sing_img);?>" class="left" alt="<?php echo $n->sing_img->description;?>" title="<?php echo $n->sing_img->description;?>" style="width: 100%;"></a>
      </div>

      <div>
        <h2><?php echo $n->title;?></h2>
        <?php echo $n->body;?>
      </div>
    </div>
  </div>

  <?php }; ?>

</div>

<?php }; ?>

 

These are the settings for the image field $sing_img

5a79a5cb38e2c_2018-02-0613_54_16-Feldbearbeiten_sing_img.thumb.jpg.0b5a9bfd16f624b2dd29df65d5b80945.jpg

And here's the strange thing happening when I try to echo the image:

$n->sing_img->url 			= 	/cms/site/assets/files/1019/
$n->sing_img				= 	filename.jpg

$n->sing_img->size(200,200)	=	INTERNAL SERVER ERROR

Fehler: Uncaught ProcessWire\WireException: Method Pageimages::size does not exist or is not callable in this context in /.../cms/wire/core/Wire.php:519
Stack trace:
#0 /.../cms/wire/core/WireArray.php(2212): ProcessWire\Wire->___callUnknown('size', Array)
#1 .../cms/wire/core/Wire.php(386): ProcessWire\WireArray->___callUnknown('size', Array)
#2 /.../cms/wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___callUnknown', Array)
#3 /.../cms/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pageimages), 'callUnknown', Array)
#4 /.../cms/wire/core/Wire.php(445): ProcessWire\Wire->__call('callUnknown', Array)
#5 /.../index.php(120): ProcessWire\Wire->__call('size', Array)
#6 {main}
thro (Zeile 519 in h.../cms/wire/core/Wire.php) 

I've no idea why this is happening, perhaps someone of you can give me a hint!

Many greets, Jens alias DV-JF

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

×
×
  • Create New...