WordPress.org

Forums

How to upload and resize an image to database? (5 posts)

  1. rosely
    Member
    Posted 7 years ago #

    Hi there :)

    I've build my own theme for a site and I've got a problem that I can't solve myself. I hope this post is in the right section. I didn't know if it should be under themes or plugins.

    After searching often, te last couple of weeks, for the right plugin, I've come to your help...
    For this site (on temp location:) http://www.vandevooren.nl/temp/wonderzine , I'm looking for a way to upload a photo in three sizes, and then portray it in the different size, depending on where we are.

    You see, if an article is new, the photo should be displayed 380px width. If it's older, it should only be a thumbnail: 72 x 72 px. Same with the categories. But then when you have a look at the article page itself, it will display the image 129px width and height.

    So one image should be uploaded in three sizes, and then be called by something like <?php the_image_size2($post_id) ?>
    or something....

    but my problem is that I'm not good at php, and thus can't make this myself... :(

    Is there anyone who knows anything that might help me?
    Thanks!!!

  2. rosely
    Member
    Posted 7 years ago #

    anyone? :$

  3. rosely
    Member
    Posted 7 years ago #

    Should this topic be posted somewhere else? Or is there just no answer? :(

  4. moshu
    Member
    Posted 7 years ago #

    First of all: you don't upload images to the database.

    The file uploads go to the directory you defined in admin > Options > Miscell.

    When an image is uploaded, WP automatically creates a thumb size of it on your server. I do't know of any script that creates a third size of it.

    And "new" and "old" are so relative and not exact terms... that nobody would be able to define them.

  5. rosely
    Member
    Posted 7 years ago #

    Thanks for your answer.
    I guess that I should just tell them that 3 sizes isn't possible then.

    And you're right, I said it wrong, file uploads go to a directory. I meant for it to be filed in such a way that I could add a 'link' in my templates to get the right size of image at a certain place.

    Too bad you don't know any script for it. (And too bad I can't make it myself).

    Thanks for your answer though :)

    I have made a difference with new and old though, by using a simple loop counting one, and stating by [0] to use a different layout, bit dirty but efficient. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic