Closed andranos closed 12 years ago
Yeah I guess you could do something like this:
if (in_array($type, array("png", "jpg", "jpeg"))) {
if (strpos($file, "thumbs") > 0) $width = 100;
else if (strpos($file, "highres") > 0) $width = 500;
else if (strpos($file, "downloadable") > 0) $width = 750;
$str .= "<img src='$url' width='$width'/> ";
} else {
$str .= "<img src='" . Router::url("/") . "ajax_multi_upload/img/fileicons/$type.png' /> ";
}
Note that the image itself will still be the original size, you have to take care of resizing it yourself. :) But this should allow you to display image sizes differently for different upload fields.
Hi
Sorry if i ask a question again Currently, I have 3 different uploads form echo $this->Upload->edit('Recipe', "thumbs/" . $this->Form->fields['Recipe.id']); echo $this->Upload->edit('Recipe', "highres/" . $this->Form->fields['Recipe.id']); echo $this->Upload->edit('Recipe', "downloadable/" . $this->Form->fields['Recipe.id']); Is there any way to change the image size based on the directories and file type? Right now, the image size is based on the file type only so basically for PNG the image will be 250x200 and so on. So for example, Image files (JPG, JPEG, PNG) on ../thumbs directory will be 275x200 Image files (JPG, JPEG, PNG) on ../highres directory will be 500x350 or something like that
Thanks in advance