#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    406
    Rep Power
    7

    Question How To Cut & Merge Text & Img Files With Php ?


    Happy Holiday Php Guys!

    You know, few yrs back I've fiddled with file cutting software where I cut a file into lots of smaller files. I've also merged lots of files into one.
    Now, I did all this with a desktop software (.exe).
    Now, I want to do it with php.
    Therefore, in order to cut & shorten and merge and enlarge text files, which functions should I look into ?
    Same question goes for img files.
    First, I want to cut an img file into many smaller files. For example, look at this img here:
    Logo Design Tool. Free and Online.

    The img shows text: Happy New Year.
    That phrase is displayed using a certain font.
    Now, I want to have each letter/char on it's own. That means, I need to cut the img file into many smaller files so each file only contain one letter/char. Eg.
    h.jpeg
    a.jpeg
    p.gpeg
    py.jpeg
    y.jpeg

    and so on.
    So, how do I break an img file into lots of smaller files ? Which function to use to do that ?
    I can break the file in 3 ways:

    1. Cut the file into many smaller files by inserting a number. Like break the big file into 10 smaller files.

    2. Cut the file into many smaller files by inserting a percentage. Like break the big file into 20% smaller files. (This would break into 5 files only).

    3. Cut the file into many smaller files by inserting a delimiter. The delimiter can be a colour. In this example:
    Logo Design Tool. Free and Online.
    If I insert black as the delimiter then each file would be separated using black as the separator. That means, each char would be separated by the black colour (background colour). Result ? I'd get each file containing one char/letter.
    You do understand what I'm trying to do, right ? From this img in our example, I'm trying to extract all the chars and save each char on a separate file on it's own. In this case, 12 files would be created for 12 chars.

    Now, I need to do all this with php. And so, how do I do it ? Which functions to use ? Have you experimented with this type of thing ?


    Erm: I always come-up with good idea projects for a beginner for my learning purpose. Is not that so ? Always adventurous. Yes, I am a different type of student. Unorthodox. A unique student. A unique way of learning student. And, you're going to be the unique type of helper.
    Where's the fun when every student or teacher does things the orthodox way ? Let's make a change.
    Last edited by UniqueIdeaMan; January 4th, 2018 at 11:52 AM.
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,531
    Rep Power
    111
    You want to break a textual image into multiple per-character images...

    Why?
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Caro, Michigan
    Posts
    14,818
    Rep Power
    4554
    Originally Posted by Triple_Nothing
    You want to break a textual image into multiple per-character images...

    Why?
    ssshhhhhh.... he's being unique!
    -- Cigars, whiskey and wild, wild women. --
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    406
    Rep Power
    7
    Originally Posted by Triple_Nothing
    You want to break a textual image into multiple per-character images...

    Why?
    To create my own fonts my way and not the orthodox way.
    So, I will go to a greeting card site and use a font to build the greeting text: Happy New Year.
    Logo Design Tool. Free and Online.

    So now, one img will contain text "Happy New Year". I will download that text and break it up so each file contains one letter only. Like:
    h.jpeg
    a.jpeg

    And so on.
    Later-on, I can write php script to call those imgs to form words that user types on a text box.
    Actually, I would need to go to such sites and type in the text box:
    abcdefghijklmnopqrstuvwxyz.
    So now, the site would produce an img with all those alpha chars.
    Then, I will break the img up so each img contains one alpha char.
    Later-on, whatever a user types on my text box, the php script would call the appropriate char img and build a single img with the user's phrase.
    So, if you type "I am who I am", then the php script would call the imgs like this after creating the appropriate variables:

    echo "$I.jpeg";echo " ";echo "$a.jpeg";echo "$m.jpeg"; and so on.

    Kicken understood what I want to do:
    How They Structure Different Style Text Generators ?
    Is This How They Build Online Greeting Cards ?

    Even though 3 different threads with 3 different subjects, but they all are one single project.

    You know what, I just realized I can just type each alpa char on this following text box and download 26 files for the 26 alpha chars:
    https://cooltext.com/Logo-Design-Iceberg
    No need for me to break & merge. But still, I would like to learn how to break & merge. Just imagine I did not find this site. Then, I would have been stuck in my project.
    In short, I want to create a site like that:
    https://cooltext.com/Logo-Design-Iceberg
    Where you can build your own text with different fonts. I need to create the fonts first to get the site up and running. Can't be bothered to build my own fonts with photoshop and the like. And so, might aswell get the fonts from these sites that are not copyrighted.

    @Sedopati,

    Merry New Year

    FYI, the greeting was unique.
    And yes, I'd like to be unique in this project too but since it is very basic idea, I reckon I can't be unique here.
    Saying all this, let's see what unique turn I can derive out of it.
    Last edited by UniqueIdeaMan; January 6th, 2018 at 02:24 PM.

IMN logo majestic logo threadwatch logo seochat tools logo