Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 112691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:35:04+00:00 2026-05-11T02:35:04+00:00

I have a requirement to save an image file in various formats. The list

  • 0

I have a requirement to save an image file in various formats. The list of formats is subject to change quite often, so I wish the saving would be very extensible. Also, the saving can take place in many places (hard disk, ftp, http, etc). The list of saving locations is going to change very often too.

I thought I would use a base Image class and many deriving classes for each format:

ImageBase {} JpegImage : ImageBase {} TiffImage : ImageBase{} 

and handle saving in each subclass appropriately to format. Is this a good design desicion?

Also, how can I attach an extensible Saving location mechanism (Ftp, file share, etc)?

I would like something like this:

var image=ImageBase.GetImageFromDisk(path); //some casting to subclass maybe?? var tiffImage=image as TiffImage; tiffImage.Location=new FtpLocation();//not sure if this is a good idea tiffImage.Save(); 

The problem here, is that concrete image implementation should not know or care about the saving location. When calling Save(); on image subclass, I would like to delegate the work to some class, like FtpLocation.

Please advice how to put the pieces together.

Thank you.

Valentin.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:35:05+00:00Added an answer on May 11, 2026 at 2:35 am

    Firstly I would implement streams on your Image. This way you can create a constructor from a stream, and a method to create a stream to any of your ‘image’ subclasses.

    Additionally, I would create your ‘saving’ infrastructure to simply accept streams and write them down onto your appropriate techniques (ftp, file etc.)

    That way you end up with extensible images (if you can get a stream to it you can do many, many things) and you end up with a saving infrastructure that is extensible as well (anything that can go to a stream can be saved)

    EDIT: Personally, a saving method on a data type object sounds like it’s in the wrong place, but without knowing your entire system I can’t say that for sure. Just my 2c.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement to download a PDF file and saving it on clicking
I have requirement where some times I would like to load children as well
I have requirement to get Facebook friends list with their images. How can I
I have a project requirement to render HTML and capture the rendered image as
We have a requirement that a user can load any standard image into a
I have a requirement to save the last screen viewed while closing the app
I have this requirement that i need to Update/Save all records from DatabaseA on
I have built a simple image viewer in .NET and have the requirement to
We have a requirement to prevent saving additional copies of PDFs that exist out
Hi I have a requirement to import spreadsheets - validate data and save to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.