• welcome

    Howto Image (picture) instance variable of the class

    Next Topic
     
    classic Classic list List threaded Threaded
    6 messages Options
    Reply | Threaded
    Open this post in threaded view
    |

    Howto Image (picture) instance variable of the class

    OswallVernyAC
    Greetings,
    I have a query about saving instances of a class that are of type image (picture).
    For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    These images must be uploaded from the Product form and displayed after uploading.
    In Seaside what would be the best procedure to do it.
    I don't know if WAFileLibrary would be the best option.
    Thanks in advance.
    Oswall

    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    Reply | Threaded
    Open this post in threaded view
    |

    Re: Howto Image (picture) instance variable of the class

    Esteban A. Maringolo
    Having picture1, picture2, as separate instance variables is a too
    naive implementation and would hit limitations very easily.

    In the next simplest implementation of this I would recommend that the
    "Product" class has a "pictures" instance variable referencing an
    OrderedCollection, and each element of such collection is the path to
    the image file on disk.

    So when you upload the file from a form you save it to a certain
    location on disk and then update the product instance collection of
    pictures.

    Regards,

    Esteban A. Maringolo

    On Thu, Jun 3, 2021 at 3:52 PM Oswall Verny Arguedas C.
    <[hidden email]> wrote:

    >
    > Greetings,
    > I have a query about saving instances of a class that are of type image (picture).
    > For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    > These images must be uploaded from the Product form and displayed after uploading.
    > In Seaside what would be the best procedure to do it.
    > I don't know if WAFileLibrary would be the best option.
    > Thanks in advance.
    > Oswall
    > _______________________________________________
    > seaside mailing list
    > [hidden email]
    > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    Reply | Threaded
    Open this post in threaded view
    |

    Re: Howto Image (picture) instance variable of the class

    Karsten Kusche
    In reply to this post by OswallVernyAC
    Hi Oswall,

    the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.

    An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
    html image document: aProduct picture1 data
    The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.

    Kind regards
    Karsten

    — 

    Georg Heeg eK
    Wallstra?e 22
    06366 K?then
    
    Tel.: 03496/214328
    FAX: 03496/214712
    Amtsgericht Dortmund HRA 12812


    Am 3. Juni 2021 um 20:52:10, Oswall Verny Arguedas C. ([hidden email]) schrieb:

    Greetings,
    I have a query about saving instances of a class that are of type image (picture).
    For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    These images must be uploaded from the Product form and displayed after uploading.
    In Seaside what would be the best procedure to do it.
    I don't know if WAFileLibrary would be the best option.
    Thanks in advance.
    Oswall
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    Reply | Threaded
    Open this post in threaded view
    |

    Re: Howto Image (picture) instance variable of the class

    OswallVernyAC
    In reply to this post by Esteban A. Maringolo
    I understand,? I have to create a collection of internal addresses of the images and they are saved in the system (folder).
    After saving it, it must be presented on the screen.
    The library to implement that is FileLibrary or there is another.
    Thanks.




    El jue, 3 de jun. de 2021 a la(s) 13:10, Esteban Maringolo ([hidden email]) escribió:
    Having picture1, picture2, as separate instance variables is a too
    naive implementation and would hit limitations very easily.

    In the next simplest implementation of this I would recommend that the
    "Product" class has a "pictures" instance variable referencing an
    OrderedCollection, and each element of such collection is the path to
    the image file on disk.

    So when you upload the file from a form you save it to a certain
    location on disk and then update the product instance collection of
    pictures.

    Regards,

    Esteban A. Maringolo

    On Thu, Jun 3, 2021 at 3:52 PM Oswall Verny Arguedas C.
    <[hidden email]> wrote:
    >
    > Greetings,
    > I have a query about saving instances of a class that are of type image (picture).
    > For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    > These images must be uploaded from the Product form and displayed after uploading.
    > In Seaside what would be the best procedure to do it.
    > I don't know if WAFileLibrary would be the best option.
    > Thanks in advance.
    > Oswall
    > _______________________________________________
    > seaside mailing list
    > [hidden email]
    > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    Reply | Threaded
    Open this post in threaded view
    |

    Re: Howto Image (picture) instance variable of the class

    OswallVernyAC
    In reply to this post by Karsten Kusche
    Hi?Karsten
    ""
    the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.
    ""
    This first part that you tell me I think is similar to what Esteban says.
    I have not implemented it. I am reviewing the documentation.

    ""
    An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
    html image document: aProduct picture1 data
    The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.
    ""
    Register url while rendering?.
    There is some documentation about it.
    Thanks

    El jue, 3 de jun. de 2021 a la(s) 23:53, Karsten Kusche ([hidden email]) escribió:
    Hi Oswall,

    the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.

    An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
    html image document: aProduct picture1 data
    The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.

    Kind regards
    Karsten

    —?

    Georg Heeg eK
    Wallstra?e 22
    06366 K?then
    
    Tel.: 03496/214328
    FAX: 03496/214712
    Amtsgericht Dortmund HRA 12812


    Am 3. Juni 2021 um 20:52:10, Oswall Verny Arguedas C. ([hidden email]) schrieb:

    Greetings,
    I have a query about saving instances of a class that are of type image (picture).
    For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    These images must be uploaded from the Product form and displayed after uploading.
    In Seaside what would be the best procedure to do it.
    I don't know if WAFileLibrary would be the best option.
    Thanks in advance.
    Oswall
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    Reply | Threaded
    Open this post in threaded view
    |

    Re: Howto Image (picture) instance variable of the class

    Karsten Kusche
    Hi Oswald,

    registering a url for a document is exactly what happens when you call: 

    html image document: aProduct picture1 data


    It’ll create a img similar to <img src=?foo/bar?_s=123&_k=432&5“>. the url comes from calling #document:. it’ll take the data, convert it into a mime-document and register it to get a url.


    Kind Regards

    Karsten


    — 

    Georg Heeg eK
    Wallstra?e 22
    06366 K?then
    
    Tel.: 03496/214328
    FAX: 03496/214712
    Amtsgericht Dortmund HRA 12812


    Am 9. Juni 2021 um 23:11:54, Oswall Verny Arguedas C. ([hidden email]) schrieb:

    Hi Karsten
    ""
    the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.
    ""
    This first part that you tell me I think is similar to what Esteban says.
    I have not implemented it. I am reviewing the documentation.

    ""
    An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
    html image document: aProduct picture1 data
    The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.
    ""
    Register url while rendering?.
    There is some documentation about it.
    Thanks

    El jue, 3 de jun. de 2021 a la(s) 23:53, Karsten Kusche ([hidden email]) escribió:
    Hi Oswall,

    the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.

    An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
    html image document: aProduct picture1 data
    The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.

    Kind regards
    Karsten

    — 

    Georg Heeg eK
    Wallstra?e 22
    06366 K?then
    
    Tel.: 03496/214328
    FAX: 03496/214712
    Amtsgericht Dortmund HRA 12812


    Am 3. Juni 2021 um 20:52:10, Oswall Verny Arguedas C. ([hidden email]) schrieb:

    Greetings,
    I have a query about saving instances of a class that are of type image (picture).
    For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
    These images must be uploaded from the Product form and displayed after uploading.
    In Seaside what would be the best procedure to do it.
    I don't know if WAFileLibrary would be the best option.
    Thanks in advance.
    Oswall
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

    _______________________________________________
    seaside mailing list
    [hidden email]
    http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

    日韩在线旡码免费视频

    HoMEպߔƵ