WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is possible to use add_image_size in functions.php to get the original uploaded file size. Because when I uploaded the images to my posts I cropped them in order to have 1x1 ratio for all my image sizes and I remember using the All images option.

So now when I use full or large I always end up with squared images. But I can see that the original uploaded files with the good proportions are still there in the uploads folder and I would like to use retrieve them if possible, somehow.

I use the following code in functions.php:

function my_attachment_all_images($postid=0, $size='full', $attributes='') {
    if ($postid<1) $postid = get_the_ID();
    if ($images = get_children(array(
        'post_parent' => $postid,
        'post_type' => 'attachment',
        'numberposts' => -1,
        'orderby' => 'menu_order',
        'post_mime_type' => 'image',)))
        foreach($images as $image) {
            $attachment=wp_get_attachment_image_src($image->ID, $size);
            ?><img src="<?php echo $attachment[0]; ?>" alt="" class="imarge" /><?php

But using 'full' for the size give me the cropped file not the original uploaded file. The output is:

myImageFile-e1343105908459.jpg (cropped 1x1)

instead of

myImageFile.jpg (original 3x2)

Many thanks for your time and help.

share|improve this question
up vote 1 down vote accepted

You can always get the url for original attachment image. I don't see any code from you so i don't know which one is good for you but there are lots of functions on core which will get you the original image.

here are some




When you scroll down bottom of the page you will see more related functions. So, searching on codex is always a good idea when you learning :)

share|improve this answer
I edited with more infos. Thanks – Gab Jul 25 '12 at 21:17
Trying to use full doesn't work like I explained. It returns the cropped version. – Gab Sep 21 '12 at 2:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.