On 23/nov/2010, at 12.30, Denis Frolov wrote:
> I think ERAttachmentViewer doesn't resize the image itself - it just passes
> the width/height to WOImage. So, this approach is indeed "heavy". You can
> create thumbnails upon upload and add them to "childrenAttachments"
> relationship. After that you can show the thumbnail by accessing it via
> "childrenAttachments" relationship on your list pages (you can add a cover
> method for thumbnail to Product.java).
So I have to create the thumb...
How can I manage the upload?
Now I override willUpdate and willInsert in ProductERAttachment entity.
@Override
public void willInsert() {
this.updateThumbnail();
super.willInsert();
}
@Override
public void willUpdate() {
this.updateThumbnail();
super.willUpdate();
}
private void updateThumbnail() {
ERImageProcessor.imageProcessor().thumbnail(40, 40, inputFile,
outputFile);
}
But... what about inputFile? How can I retrieve it from the ERAttachment object?
>
> To fix the exception try adding the rule like this:
>
> entity.name = 'Product' and task = 'edit' and propertyKey = 'photos' =>
> destinationEntityName = 'ERFileAttachment'
It doesn't fix the problem...This is strange... in a previous test (some days
ago) I did not have this error... just the form encryption exception...
Francesco
>
> Denis
>
> On Tue, Nov 23, 2010 at 1:51 PM, Francesco Romano <[email protected]>
> wrote:
> Some updates after some hours of work
> Let's start with thumbnails.
> First of all... if in the ERAttachmentViewer I bind either the width or
> height, it resize correctly the picture.. now.. the question is can this
> become "heavy"? I think I'll use the thumbs only in list pages..or is better
> to create the thumb on insertion and simply display it later?
>
> About D2W rule... if i use as a component ERDList, I don't have the new
> button to add the image.
> This is the entity I create:
> <Screen shot 2010-11-23 at 11.45.07.png>
>
> If I don't create any rule, this is what I see in the CreateProduct page:
> <Screen shot 2010-11-23 at 11.47.16.png>
>
> Then, if I press New:
>
> Nov 23 11:47:47 PNStoreAdmin[5100] WARN NSLog -
> <er.ajax.AjaxRequestHandler>: Exception occurred while handling request:
> com.webobjects.foundation.NSForwardException
> [java.lang.InstantiationException] null:<er.attachment.model.ERAttachment> is
> an abstract class. It can not be instantiated !
> [2010-11-23 11:47:47 CET] <WorkerThread3>
> com.webobjects.foundation.NSForwardException
> [java.lang.InstantiationException] null:<er.attachment.model.ERAttachment> is
> an abstract class. It can not be instantiated !
> at
> com.webobjects.foundation._NSUtilities._explainInstantiationException(_NSUtilities.java:616)
> at
> com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:665)
>
>
>
> Francesco
>
> On 23/nov/2010, at 08.48, Francesco Romano wrote:
>
>>> Are you actually going to display multiple photos for a Product?
>>>
>>> Or are you displaying ...
>>>
>>> one thumbnail
>>> or
>>> one big photo
>>> or
>>> one medium photo
>>>
>>> David
>>
>> What I want is the possibility to have many photos for a product. And i need
>> one thumbnail (but I think I'll thumbnail every photos, otherwise it'l
>> become a bit complex to manage everything..).. So in the list page I display
>> the thumb, in the Inspect page I display all the photos (I don't know if
>> every photo in the same moment, or just a sort of embedded gallery in the
>> page with next and previous button..)
>>
>> I'll try this morning creating a new project and a new db connection, to not
>> destroy my old one, until I find the right migration
>>
>> On 23/nov/2010, at 06.41, Denis Frolov wrote:
>>
>>> On Mon, Nov 22, 2010 at 11:27 PM, Francesco Romano
>>> <[email protected]> wrote:
>>>> Ok.. I'll try this for the thumbnail..
>>>>
>>>> About D2W...
>>>> I have something like
>>>>
>>>> Product <-->> ERAttachment for a photos property.
>>>> But.. i watched the tutorial of David and he created a many-to-many, so
>>>> Product <-->> ProductPhotos <<--> ERAttachment
>>>> Product has a "photos" property (so a NSArray of ERAttachment).
>>>> But.. I don't know how to manage this with the rules, both on Inspect and
>>>> on Edit/Create configuration.
>>>> BTW: how can I select the first object of an array with a rule?
>>>
>>> You could try "[email protected]" but I think a better way would
>>> be to add a cover method "thumbnail" to your Product.java returning
>>> the attachment you need and use it in rule.
>>>
>>>> What I want to do is:
>>>> In ListProduct configuration I want to display the thumbnail
>>>
>>> Cover method above would help you with this.
>>
>> I'll go for the cover method
>>
>>>
>>>> In Edit/Create Product configuration I want to display all the photos in
>>>> "maximum" size (i don't know yet the size.. I'll decide later)
>>>
>>> We use our own custom component for this, but I think you could use
>>> ERDList or ERMDEditRelationship to display/edit the list of photos,
>>> e.g.:
>>>
>>> entity.name = 'Product' and task = 'edit' and propertyKey = 'photos'
>>> => componentName = 'ERDList'
>>>
>>
>> I think I already tried something like that and it didn't work.... I'll try
>> again..
>>
>> Francesco
>>
>>> Denis
>>>
>>>>
>>>> Thanks again for your answers
>>>>
>>>> Francesco
>>>>
>>>> On 22/nov/2010, at 21.05, Denis Frolov wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> In fact, the support for thumbnails is already there in the model of
>>>>> ERAttachment. Note the "parentAttachment"/"childrenAttachments"
>>>>> relationships and "thumbnail" attribute. Just create a new
>>>>> ERAttachment for thumbnail and add it to "childrenAttachments" of
>>>>> original attachment. You can use "thumbnail" attribute to specify the
>>>>> size of the thumbnail in case you need multiple thumbnails of
>>>>> different sizes. We use strings like "200x150" for "thumbnail"
>>>>> attribute.
>>>>>
>>>>> As for the D2W, could you be more specific on what the problem is?
>>>>>
>>>>> Denis
>>>>>
>>>>> On Mon, Nov 22, 2010 at 7:49 PM, Francesco Romano
>>>>> <[email protected]> wrote:
>>>>>> Hi.
>>>>>> I have two questions about ERAttachment.
>>>>>> 1) Thumbnails are not available, yet, but.. what do I have to do to add
>>>>>> support to them? I don't understand how to implement them "inside"
>>>>>> erattachment
>>>>>> 2) I'd like to have a many-to-many relationship between my entity and
>>>>>> erattachment. I don't have problems in modeling, but.. how can I manage
>>>>>> them using D2W and rules? (I'm creating two apps: an admin app using D2W
>>>>>> Modern look, and a "front-end" app without D2W. I have problem in the
>>>>>> D2W side...)
>>>>>>
>>>>>> Thank for any help
>>>>>> Francesco Romano
>>>>>>
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list ([email protected])
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>>>>>>
>>>>>> This email sent to [email protected]
>>>>>>
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list ([email protected])
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>>>>
>>>> This email sent to [email protected]
>>>>
>>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/dfrolov%40demax.ru
>
> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]