#42
Posted 19 January 2012 - 08:28 AM
#44
Posted 20 January 2012 - 01:05 PM
I tried the following code in my template anyway:
echo $page->my_photo->eq(0)->getThumb('thumbnail');And I get the following error:
Error Exception: Method Pageimage::eq does not exist or is not callable in this context
Any ideas? Anyone else had the same problem with this module in the latest version of PW?
#45
Posted 22 January 2012 - 06:45 AM
It displays as a normal image field as you say and I get none of the crop links for my configured crops next to the images.
#46
Posted 22 January 2012 - 10:45 AM
protected function renderItem($pagefile, $id, $n) {
$out = parent::renderItem($pagefile, $id, $n);
$crops = $this->modules->get('ProcessCropImage')->crops;
if (strlen($crops)>3) {
$cropUrl = "../image-crop/";
$cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($crops, $cropUrl, $pagefile) . "</div>";
}
// We add our crop string at the end of the list item that holds image
$out .= $cropStr;//str_ireplace('</li>', $cropStr, $out);
return $out;
}
#47
Posted 22 January 2012 - 12:29 PM
For example, in the module config, enter a new crop setup called bigthumb like this:
bigthumb,320,240,home,search
The two extra parameters on the end are templates that this is applicable to. You can keep adding templates to the list to your hearts' content, and in this case it won't show you a thumbnail option for the images field on the basic-page template since you narrowed it to a specific list.
If you want the thubmnail to be available to all templates, simply don't add any more parameters after the first three
The code, oddly enough, is in the same function as my last post, so change that entire function in InputCropImage.module to the following:
protected function renderItem($pagefile, $id, $n) {
$out = parent::renderItem($pagefile, $id, $n);
$crops = $this->modules->get('ProcessCropImage')->crops;
if (strlen($crops)>3) {
// If we've defined one or more templates for specific crops, we need to check the current page's template to see if we actually have any applicable crops to show to the user
$page = $this->pages->get($this->input->get->id);
$applicableCrops = array();
$cropArray = explode("\n", $crops);
foreach ($cropArray as $k => $v) {
$cropItems = explode(',', $v);
if (count($cropItems) > 3) {
if (in_array($page->template, array_slice($cropItems, 3))) {
$applicableCrops[] = $cropArray[$k];
}
} else { // Any non-template-specific crops are automatically added to the list for all cropimage fields
$applicableCrops[] = $cropArray[$k];
}
}
$applicableCrops = implode("\n", $applicableCrops);
if (!empty($applicableCrops)) {
$cropLinks = $this->_getCropLinks($crops, $cropUrl, $pagefile);
if (!empty($cropLinks)) {
$cropUrl = "../image-crop/";
$cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($applicableCrops, $cropUrl, $pagefile) . "</div>";
// We add our crop string at the end of the list item that holds image
$out .= $cropStr;
}
}
}
return $out;
}If no crops are applicable to a particular template, it simply doesn't render the thumbnails box below each image.
#48
Posted 22 January 2012 - 04:54 PM
Pete: if possible can you send me an pull request in Github? This way you get proper mention on your contribution.
#49
Posted 22 January 2012 - 04:57 PM
I'll do it tomorrow when I'm back at my computer (and can figure out GitHub again - I don't use it often enough to remember how it works
#51
Posted 26 January 2012 - 07:59 AM
#52
Posted 28 January 2012 - 11:25 PM
Antti, the only issue I have is not being able to see the thumbnail previews when hovering over the thumbnail names in that field.
Regards
Marty
#53
Posted 29 January 2012 - 06:39 AM
Notice: Undefined variable: cropUrl in C:\xampp\htdocs\blah\site\modules\InputfieldCropImage\InputfieldCropImage.module on line 48
#54
Posted 29 January 2012 - 06:58 AM
In InputfieldCropImage.module, before this line:
$page = $this->pages->get($this->input->get->id);
add this
$cropUrl = "../image-crop/";
I don't think this has anything to do with the hover not working to preview thumbnails though - not sure what that is to be honest, possibly something with a newer version of jQuery maybe? I can't figure it out though it is affecting my PW 2.2 site.
I'll commit my latest code change shortly and do another pull request Antti.
#55
Posted 29 January 2012 - 11:24 AM
the only issue I have is not being able to see the thumbnail previews when hovering over the thumbnail names in that field.
Marty - do you happen to have the HelperFieldLinks module installed? If so, the problem might be something with this part of the module's css.
.ui-widget-content{
overflow:hidden; /*clear floats*/
}
If you do have it installed, you can comment that out. I don't think there's a significant problem doing that. From what I saw, the helper link to the field/template that appears below the field simply doesn't have the proper spacing below it.
#56
Posted 29 January 2012 - 05:34 PM
Marty - do you happen to have the HelperFieldLinks module installed?
Hi Hani,
No I don't have that one installed. I'm sure it's just something small that's causing it. To be expected with a new version of PW
Regards
Marty
#57
Posted 29 January 2012 - 05:46 PM
#58
Posted 30 January 2012 - 02:31 AM
#59
Posted 30 January 2012 - 03:39 AM
I fixed that one by changing the InputfieldCropImage.js a little. The live hover event wasn't working. I changed it from "mouseenter" to "mouseover", and it's working now.
I'm not sure about github. I have the repo local and commited the fix just now, but I don't know if it gets commited or apeisa needs to pull the commit first...
So heres the code for those interested:
$(document).ready(function() {
$("a.crop").live("hover", function(e) {
if( e.type === 'mouseover') {
url = $(this).data('thumburl') + "?timestamp=" + new Date().getTime();
$(this).append("<img style='position: absolute; z-index: 999;' src="+url+" />");
}
else {
$(this).find("img").remove();
}
});
$(".InputfieldCropImage .InputfieldFileList").live('AjaxUploadDone', function() {
console.log("it should");
$("a.InputfieldFileLink", $(this)).fancybox();
});
/* Modal disabled, cropping huge images is very difficult with modals
$("a.crop").live("click", function() {
var url = $(this).attr('href');
var windowHeight = $(window).height() - 120;
var windowWidth = $(window).width() - 120;
$iframe = $('<iframe id="pwimage_iframe" width="100%" frameborder="0" src="'+url+'"></iframe>');
$iframe.parent().css('position', 'fixed').end().dialog({
title: "Crop Image",
height: windowHeight,
width: windowWidth,
position: [60, 60],
modal: true,
overlay: {
opacity: 0.7,
background: "black"
}
}).width(windowWidth).height(windowHeight);
return false;
});
*/
});
@somartist | modules created | support me, flattr my work flattr.com
#60
Posted 30 January 2012 - 05:06 AM
Also tagged with one or more of these keywords: Module
Community Support →
Modules/Plugins →
Page Edit Per RoleStarted by pogidude, Yesterday, 10:01 PM |
|
|
||
Community Support →
Modules/Plugins →
Module: TemplateHasTagsStarted by MichaMichaMicha, 20 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Release: LocalAudioFiles MP3-DBStarted by horst, 19 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Inline EditorStarted by Sinmok, 10 May 2013 |
|
|
||
Community Support →
Modules/Plugins →
Module: Site indexerStarted by Alessio Dal Bianco, 08 May 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













