Quick search:

Simple way to handle with images?

MiKe
2013-10-27 17:42:27
 
Hello,
is there a simple way to handle with images?
In your example1:
I want to add a derived Property that shows an image of the employee.

suggestion:

$this->addDerivedProp('employeepic', 'img');


function getEmployeepic() {
  // some code, that creates the following html:
  //
  //
}


I hope you know what i mean.

Regards,
MiKe
Henk
2013-10-28 14:16:31
 
Hi Mike,

There is a little more to it then you suggest:

Properties are in the domain tier. This tier should be independent from the way it is represented by the user interface. In fact, multiple representations of the same things may exist in one or more user interfaces. For example a large image and a small thumbnail in HTML, another in a native app on an Andriod devide and another one on IOS.

The domain tier may contain image objects that include graphics data, or now how to get the data from (a file on) the http server. But usually the images need to be managed so you probably need an image list, search and upload capabilities. This is out of scope for a general application framework like phpPeanuts. It is usually done by a CMS.
Henk
2013-10-28 14:17:26
 
MetaClass has built a CMS on top of phpPeanuts. But that is not available in open source. We sometimes use a stripped version of the CMS for applications that contain images. The CMS then takes care of the image management. For this it contains a class 'Bestand' (dutch for 'File') and a subclass 'Afbeelding' (dutch for 'Image'). And a bunch of user interface classes for showing and uploading individual images and for searching and browsing in a list of images.

In the application individual single value properties that refer to images are then coded as derived properties with type 'Afbeelding' using another property to hold the afbeeldingId. Selecting an Afbeelding is done with an AfbeeldingSearchDialog from the CMS that phpPeanuts uses automatically like it allways does if a specialized dialog class is available. However, to see the image on the same page where you select it, we add a custom skin for the type holding the property (see example 5) and manually code the img tag there. For multi value properties (derived through an extra AfbeelingRelation class for each property) we have an AfbeeldingTablePart class in the cms that is used automatically by phpPeanuts through the general Part specialization mechanism. It shows the thumbnails of the images in an extra column.

I can send you these CMS classes if you want. However, the code is in Dutch and they may not work right away because they may be connected to other CMS classes. You will have to remove the connections yourself and may have to adapt the user interface classes and skins to your changes. And there is no developers documentation. There will be no updates or newer versions, you will have to maintain them yourself.

Greetings,
Henk.
MiKe
2013-10-28 22:26:25
 
Hi Henk,

thanks for your reply and explanation of what a framework should do, and what not.
I already thought that it would not be easy.
But it would be great, if you can send me these CMS classes.
I do my best to understand your code. But maybe it takes time.

Greetings,
MiKe
Henk
2013-10-29 13:46:00
 
Hi Mike,

OK, i'll send the CMS code to your e-mail adress.

Yes, peanuts is known to have a pritty steep learning curve. I definitely underestimated that problem when i open sourced it. I now think of porting some of the Parts, Widgets and Dialogs to ZF2 or SF2. Or maybe there is already a set of 'object aware' widgets for ZF2 or SF2 that i can amend.

Greetings,
Henk.
Add a Reply
Loading form, please wait
The website will not send you an e-mail when a reply is added to this topic

Back to Topics List