Jump to content

Release: Thumbnails


apeisa

Recommended Posts

  • 3 weeks later...

I have the code belows that throws me this error:

Error: Exception: Method Pageimages::getThumb does not exist or is not callable in this context (in /Applications/AMPPS/www/tci/wire/core/Wire.php line 349)

I am using Processwire 2.5.3. professionnel_photo is an image field and it is set to use the CropImage module. And it works on the admin side. Any idea of what is wrong?  

<?php 
	$equipe = $pageEquipe->children;
	foreach($equipe as $membre): ?>
		<div class="membre">
			<div class="photoMembre">
				<?php if($membre->professionnel_leader){
					image($membre->professionnel_photo->getThumb('leader'));
					}else{
					image($membre->professionnel_photo->getThumb('miniature'));		
					} ?>
			</div>
			
		</div>
	<?php endforeach ?>

Edited by kongondo
@Guy: Moved this here in this module's support forum where I think it fits better. Hope you don't mind.
Link to comment
Share on other sites

ah, have to re-read before answer!

Please, what code do you use in image() ??

Heureka! Ok, now I have it!

$membre->professionnel_photo is a collection (Pageimages), but it should be a single Pageimage!

Edited by horst
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

Suddenly getting an error on any pages using CropImage

Width and height not found for thumb:

This is in the admin and not the front end of the site. I never had a CropImage called "thumb" so I assume some of the error message is missing?

You'll notice too how the page fields fail to load. After the page title, I had several fields and 2 image fields with CropImage settings.

I hadn't edited a CI setting or removed any in between the time the pages/images were working and when they stopped.

Is there somewhere in the database, I can find more detail of whats wrong?

post-1166-0-70378900-1416688103_thumb.pn

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Using PW2.5.3 the field seems to work nicely.

post-847-0-39442200-1422612763_thumb.jpg
 
In the PAGE edit the options are there - nice:
post-847-0-49055500-1422612903_thumb.jpg

.. but this is not working on the front end. I know that I need to do something in the template and have tried the following.

<?php

echo $page->image->eq(0)->getThumb();
?>

Can someone help me to get the statement correct for the image in the template?

post-847-0-39442200-1422612763_thumb.jpg

post-847-0-49055500-1422612903_thumb.jpg

Edited by kongondo
@icreation, where a module has its own support forum, please use that for support rather than starting a new topic, thanks
Link to comment
Share on other sites

From the docs

echo $page->cropImages->eq(0)->getThumb('thumbnail');

In your case then

echo $page->cropImages->eq(0)->getThumb('square'); // 400*400 thumbnail
echo $page->cropImages->eq(0)->getThumb('landscape'); // 400*300 thumbnail
echo $page->cropImages->eq(0)->getThumb('portrait'); // 340*453 thumbnail
Link to comment
Share on other sites

Thanks for coming back to me. I cannot get this to work and just wondered about the syntax for this?

The name of my field is sideimage and this would normally be called by

<?php echo '<img src="'.$page->sideimage->url." />'; ?>

If I change the type of image to cropImage what would be the syntax to call this image?

Link to comment
Share on other sites

I'd like to use this module for cropping images to use in a slider. So I setup a CropImage field that can be used to upload several images. It is called "slider".

Now I don't get it working and need a hint.

My code for the slider:

$imgs = $page->slider;
if (count($imgs)) {
   foreach ($imgs as $img) {
     echo "<li><img src='{$img->getThumb('slider')->url}' alt='$img->description' /></li>";
   }
};

Output: no images, only descriptions.

Thanks for help.

Link to comment
Share on other sites

As written a few posts above: In contrast to the new croppableimage module, thumbnails' getThumb() does not return a new image object, but only the url, so there's no need to call ->url on it. Enabling debug mode should even throw an error on this one. 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

with the new dev 2.5.19 there is a problem with this module. i think it must have something to do with the new image handling with retina support: https://processwire.com/blog/posts/new-image-editing-features-2.5.19/

the image is double size on the "wow, that looks great" screen and also on the frontend when displaying via ->getThumb()

nevertheless thank you for this great module!

Link to comment
Share on other sites

After moving a site from my local xampp to a live server, I encounter problems with the images upload: even though the red progress bar goes up to 100%, nothing happens afterwards. No thumbnails. And after safeing the page, there are no images at all.

I tried to change the module and .htaccess as mentioned above, but got no results.

Edit:

It turned out, that I had cropping information for landscape images, that exhausted the memory. So the thumbs could not be created. That seemed to have blocked everything.

Link to comment
Share on other sites

  • 2 months later...

Hi Apeisa, I've found a bug.

When using a cropimage field inside of a repeater field, the description of the image does not save. 

The puzzling part is that I think it used to at some point, since I have images with descriptions still there in the install.

But now I've run into this problem on any install I try (they are all on the same server and I haven't changed the server config). 

I tried a fresh install of 2.5.2.8 and 2.5.2.9 (dev), as well as 2.5.3 (master) and it also happens on 2.3.0. The bug happens with even just the default install and the Thumbnails modules installed, nothing else, on a clean install.

Debug mode is enabled but shows no errors or warnings. Console is clean.

Normal image fields' descriptions still do save, but if I switch them to CropImage they stop working.

I can give you access to an account on the server if you can't reproduce the bug for some reason, just let me know.

Thanks!

Link to comment
Share on other sites

  • 1 month later...

hey apeisa,

i found a bug when using your module with the new 2.6 version (left how it looks like with 2.5.3 which is ok)

post-2137-0-57471600-1433612527_thumb.pn

this makes it impossible to switch between grid/list view making it also impossible to delete images, so that's a serious thing :(

you can use my test-installation from here: http://stuff.zwergo.net/cropbug.zip

user admin

pw admin!

database is in /site/assets/backups/database/test-2.6.1.sql

DB name is test

page "test" has template "test" with the bug on it.

your help would be greatly appreciated :)

Link to comment
Share on other sites

hi martijn,

it's definitely related to the crop-field. at least in my setup! when i remove the field everything works as expected. when i put it back into the template, the bug appears again. note that it appears only when the field is already populated with images! on first upload it seems to work well.

nothing in the console!

Link to comment
Share on other sites

  • 2 weeks later...

I'm getting this right now (right after updating from 2.4.3 to 2.4.5), so it's definitely an outstanding issue. Will have to dig in to see what's going on..

Edit: Just guessing, but could this be related to this commit and the part about "6) Convert Fieldtype modules to load on-demand rather than all at boot"? Looks like after the update when InputfieldCropImage runs, FieldtypeCropImage hasn't been init'd yet.. which obviously results in getThumb() not being available.

Anyway, will have to debug more.

Edit 2: Whether or not that was the issue, I've solved it locally by making sure that FieldtypeCropImage is loaded with InputfieldCropImage. I can't uninstall the module or try other tricks on this site, as it's already in production -- I'm assuming that Antti or Ryan will dig out the real reason (and fix) for this, but in the meantime this works for me:

Index: InputfieldCropImage.module
===================================================================
--- InputfieldCropImage.module  (revision 7702)
+++ InputfieldCropImage.module  (working copy)
@@ -13,7 +13,8 @@

        public function init() {
                parent::init();
-
+               // make sure FieldtypeCropImage is loaded
+               $this->modules->get("FieldtypeCropImage");
                //default settings
                $this->set('thumbSetting', 'thumbnail,100,100');
        }

Has there ever been a permanent fix for this? I've updated a site from Processwire 2.3.15 to 2.6.1 and FieldtypeCropImage::init() isn't called any more which results in the known Method Pageimage::getThumb does not exist or is not callable in this context problem.

I don't see how I can get this working without manually loading the FieldtypeCropImage module everytime before using getThumb() (or making it an autoload module for convenience). Is this generally working for you in 2.6.x?

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
×
×
  • Create New...